Using Integrations
API Keys and Personal Access Tokens
Lots of APIs use API Keys or Personal Access Tokens to authenticate. This guide will show you how to use them.
1. Create an Integration client
Note that we used process.env.GITHUB_TOKEN
and process.env.OPENAI_API_KEY
. They’re environment variables, which are a way of not putting secret values directly in your code.
For Next.js, local environment variables usually live in a .env.local
file in the root of the project.
.env.local
2. Use the Integration client
There are two way to use Integrations in a Job:
- You can perform Tasks in the
run
function, by passing the Integration client into theintegrations
object. - You can use webhooks to Trigger a Job.
This example automatically assigns “matt-aitken” to any new issue in the trigger.dev
repo (lucky him).
3. Viewing connections in the dashboard
The Integrations page
The "Integrations" page shows
- Some of the APIs that you can use with Trigger.dev (you can use any API). Selecting one of these will give you instructions on how to use it.
- Your connected integrations. Clicking these will give you more details on that connection.
Connected API Key Integration detail page
Some useful things on this page
- The
id
that you gave the connection when you defined it in your code - The Jobs that are using this connection
References
Was this page helpful?