Title: Create an example job using the PagerDuty API · Issue #44 · triggerdotdev/api-reference · GitHub
Open Graph Title: Create an example job using the PagerDuty API · Issue #44 · triggerdotdev/api-reference
X Title: Create an example job using the PagerDuty API · Issue #44 · triggerdotdev/api-reference
Description: Overview: While we build our official integrations, we want to create examples of how to create jobs which use other APIs with Trigger.dev. This reference will be used in the app on any service we don’t have an integration for yet. Detai...
Open Graph Description: Overview: While we build our official integrations, we want to create examples of how to create jobs which use other APIs with Trigger.dev. This reference will be used in the app on any service we ...
X Description: Overview: While we build our official integrations, we want to create examples of how to create jobs which use other APIs with Trigger.dev. This reference will be used in the app on any service we ...
Opengraph URL: https://github.com/triggerdotdev/api-reference/issues/44
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Create an example job using the PagerDuty API","articleBody":"## Overview:\r\n\r\nWhile we build our official integrations, we want to create examples of how to create jobs which use other APIs with Trigger.dev. This reference will be used in the app on any service we don’t have an integration for yet.\r\n\r\n## Details:\r\n\r\nIn this example, you will build a simple job which uses the PagerDuty API. This will replace the GitHub example we currently have in the app:\r\n\r\n\r\n\r\n## Requirements:\r\n\r\n- Use the structure of our [GitHub API reference file](https://github.com/triggerdotdev/api-reference/blob/main/src/github.ts).\r\n- The job must connect to the [PagerDuty API](https://developer.pagerduty.com/docs/ZG9jOjExMDI5NTUw-rest-api-v2-overview), using their official SDK, and return an example payload from the API.\r\n\r\n## Guidelines:\r\n\r\n- The job should use an `eventTrigger`.\r\n- The job should use `zod` to define the payloads.\r\n- Use native fetch where no official SDK or incompatible auth\r\n- Only use `io.backgroundFetch()` where absolutely necessary\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. [The Discord example](https://github.com/triggerdotdev/api-reference/blob/main/src/discord.ts) is the level of commenting we are looking for. \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\n2. Create a new file in the src folder, named to match the API (e.g. GitHub would be called github.ts).\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\r\n> [!IMPORTANT]\r\nYou must test this Job works before submitting your PR, including a 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-10-26T15:40:53Z","url":"https://github.com/triggerdotdev/api-reference/issues/44"}
| 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:7d762d59-ea24-cfd4-9cc5-6810646ffeb7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C86A:8BAE:19DD21:249393:6AFB6AC3 |
| html-safe-nonce | 08a628d355dde1c8e1a595ff56305547a38655e3ad06a31ef07253ce4c5ebcc9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODZBOjhCQUU6MTlERDIxOjI0OTM5Mzo2QUZCNkFDMyIsInZpc2l0b3JfaWQiOiIyMjM4NTc5MjQ5MDEzMDI1NDc1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | dd7f37d5dec8fc4d9006ce6f77936fef09450eb4ef914be1cc8e21cf46753a5f |
| hovercard-subject-tag | issue:1963850510 |
| 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/44/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2aa31d3e5c647d6df2aae251e27e714fcbaadd1f0385bedb02bf9bd1aec6777d/triggerdotdev/api-reference/issues/44 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2aa31d3e5c647d6df2aae251e27e714fcbaadd1f0385bedb02bf9bd1aec6777d/triggerdotdev/api-reference/issues/44 |
| og:image:alt | Overview: While we build our official integrations, we want to create examples of how to create jobs which use other APIs with Trigger.dev. This reference will be used in the app on any service we ... |
| 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 | cca289ecd54650fcf3c0b037a58b97186dee2cc4406819d87fab93728fd83700 |
| 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 | 88808b1fae5ab8a526a73e7ce5542a10eb9d6971 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width