Use Auth Resolvers to provide custom authentication credentials
TriggerClient
instance, define a new Auth Resolver for the slack
integration:
byoSlack
integration into the Job and using it by calling io.slack.postMessage
.
byoSlack
integration will fail with an “Unresolved auth” error.id
.
accountId
when calling sendEvent
:
accountId
value is completely arbitrary and doesn’t map to anything inside Trigger.dev, but generally it should be a unique ID that can be used to lookup Auth credentials in your Auth Resolvers.
You can also send events with an associated account ID from the run of another job:
intervalTrigger
or cronTrigger
into using a Dynamic Schedule and then registering schedules with an associated account ID.
intervalTrigger
to a Dynamic Schedule:
dynamicInterval
instance to register a schedule, which will trigger the scheduled-job
:
accountId
, so any runs triggered by this schedule will be associated with "user_123"
The first parameter above "schedule_123"
is the Schedule ID and can be used to unregister the schedule at a later point:
Create Dynamic Trigger
onIssueOpened
event:Use the Dynamic Trigger
Define Auth Resolver
write:repo_hook
and read:repo_hook
or just
admin:repo_hook
. If you want to create issues you’ll need repo
or public_repo
.Register a new trigger
ctx
parameter is the TriggerContext for the run and the integration
parameter is the TriggerIntegration instance that the Auth Resolver is being called for. You can use the integration
parameter to check the id
of the integration to determine which integration the Auth Resolver is being called for:
additionalFields
in the Auth Resolver result which will be passed to the integration when making requests. This is useful if you need to provide additional fields to the integration that are not part of the standard integration options.