Title: Create an example Asana job which uses an HTTP endpoint / trigger · Issue #108 · triggerdotdev/api-reference · GitHub
Open Graph Title: Create an example Asana job which uses an HTTP endpoint / trigger · Issue #108 · triggerdotdev/api-reference
X Title: Create an example Asana job which uses an HTTP endpoint / trigger · Issue #108 · triggerdotdev/api-reference
Description: Overview HTTP endpoints allow you to subscribe to changes from an API. You can use defineHttpEndpoint to receive webhooks, verify them, and create an HTTP Trigger. Details: The task is to create a job example which is triggered by an HTT...
Open Graph Description: Overview HTTP endpoints allow you to subscribe to changes from an API. You can use defineHttpEndpoint to receive webhooks, verify them, and create an HTTP Trigger. Details: The task is to create a ...
X Description: Overview HTTP endpoints allow you to subscribe to changes from an API. You can use defineHttpEndpoint to receive webhooks, verify them, and create an HTTP Trigger. Details: The task is to create a ...
Opengraph URL: https://github.com/triggerdotdev/api-reference/issues/108
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Create an example Asana job which uses an HTTP endpoint / trigger","articleBody":"### Overview\r\n\r\nHTTP endpoints allow you to subscribe to changes from an API. You can use `defineHttpEndpoint` to receive webhooks, verify them, and create an HTTP Trigger.\r\n\r\n### Details:\r\n\r\nThe task is to create a job example which is triggered by an HTTP Trigger when a change is received from Asana.\r\n\r\nReference material:\r\n\r\n- Read our [HTTP endpoints docs](https://trigger.dev/docs/documentation/concepts/http-endpoints) \r\n- Read our [SDK reference docs](https://trigger.dev/docs/sdk/http-endpoint)\r\n- Check out our simple [Cal.com example](https://github.com/triggerdotdev/api-reference/blob/main/src/cal-http-endpoint.ts). This is a simple implementation.\r\n- Check out our [WhatsApp example](https://github.com/triggerdotdev/api-reference/blob/main/src/whatsapp-http-endpoint.ts). This is a more advanced implementation (using `respondWith`) because WhatsApp sends a verification GET request to confirm before the webhooks can be created. Most APIs don't required this.\r\n\r\n### Requirements:\r\n\r\n- Use the structure of our [Cal.com example](https://github.com/triggerdotdev/api-reference/blob/main/src/cal-http-endpoint.ts).\r\n- The example must connect to Asana, receive a payload which triggers an HTTP Trigger, and then perform a simple job.\r\n\r\n### Guidelines:\r\n\r\n- The code must use TypeScript\r\n- The job must use an HTTP Trigger\r\n- Create a TypeScript type for the webhook, ideally use types from the official SDK from the API.\r\n- Cast the json to that type using `const body = await request.json() as WebhookPayload` \r\n- Use native fetch where no official SDK or incompatible auth\r\n- Avoid external packages apart from official SDKs\r\n- Prefer REST over GraphQL - avoid raw queries\r\n- Use a minimal `io.runTask()` callback - initialise clients and auth in global scope if possible\r\n- Leave clear comments with links to relevant developer docs, API key pages etc. \r\n\r\n### Required structure:\r\n\r\n1. Follow [this guide](https://github.com/triggerdotdev/api-reference#setup-how-to-use-this-repo) to get the project setup.\r\n\r\n2. Create a new file in the src folder, named to match the API, with '-http-endpoint' at the end (e.g. GitHub would be called `github-http-endpoint.ts`).\r\n\r\n3. The Trigger.dev client must be defined at the top of the job, with the 'api-reference' id:\r\n\r\n```ts\r\nconst client = new TriggerClient({ id: \"api-reference\" });\r\n```\r\n\r\n4. You must add the Express specific lines to the bottom of the Job file:\r\n\r\n```ts\r\n// These lines can be removed if you don't want to use express\r\nimport { createExpressServer } from \"@trigger.dev/express\";\r\ncreateExpressServer(client);\r\n```\r\n\r\n5. You must add the new script to the package.json file, in this format:\r\n\r\n```ts\r\n\"scripts\": {\r\n //..other scripts\r\n \"\u003capi-name>\": \"nodemon --watch src/\u003capi name>.ts -r tsconfig-paths/register -r dotenv/config src/\u003capi name>.ts\"\r\n}\r\n```\r\n> [!IMPORTANT]\r\nYou must test this Job works before submitting your PR, including a video or screenshot of a successful run. This may involve you having to setup accounts with services.\r\n>","author":{"url":"https://github.com/D-K-P","@type":"Person","name":"D-K-P"},"datePublished":"2023-11-21T11:02:12Z","url":"https://github.com/triggerdotdev/api-reference/issues/108"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bebd183c-7c7f-37de-60e4-2336094aae62 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E2A6:1DEF92:A7B0F7:EE54C0:6AFADAB8 |
| html-safe-nonce | 190e89c6092ef7921fb403f111c652e6d988caabf71adec9b23394425e9cefcd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMkE2OjFERUY5MjpBN0IwRjc6RUU1NEMwOjZBRkFEQUI4IiwidmlzaXRvcl9pZCI6Ijc0OTA2ODEyNjk2NDY5NzM2MjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6fa89766729f1fb21d4b823551ac0cc98f53cde170999670313424301cae90a0 |
| hovercard-subject-tag | issue:2004018269 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/triggerdotdev/api-reference/108/issue_layout |
| twitter:image | https://opengraph.githubassets.com/523bc4f078fd1bef074cba894a9a95f77ceb44e4020fb644b86195b4889b3db3/triggerdotdev/api-reference/issues/108 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/523bc4f078fd1bef074cba894a9a95f77ceb44e4020fb644b86195b4889b3db3/triggerdotdev/api-reference/issues/108 |
| og:image:alt | Overview HTTP endpoints allow you to subscribe to changes from an API. You can use defineHttpEndpoint to receive webhooks, verify them, and create an HTTP Trigger. Details: The task is to create a ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | D-K-P |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9d9bd51a568909a83d1abb9d6f74d68f0c87ca85fe3a56d3f5d70d8b89add9f2 |
| turbo-cache-control | no-preview |
| go-import | github.com/triggerdotdev/api-reference git https://github.com/triggerdotdev/api-reference.git |
| octolytics-dimension-user_id | 95297378 |
| octolytics-dimension-user_login | triggerdotdev |
| octolytics-dimension-repository_id | 706112555 |
| octolytics-dimension-repository_nwo | triggerdotdev/api-reference |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 706112555 |
| octolytics-dimension-repository_network_root_nwo | triggerdotdev/api-reference |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a7ae932999cc6d511008dbf980ff9efad2a31f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width