Invoke Jobs manually using the invoke Trigger
invokeTrigger()
function when defining a job:
Job.invoke()
method:
invokeTrigger()
:
Job.invoke()
method. This method returns a JobRun
object that you can use to track the progress of the job run, especially in conjunction with our React hooks, like useRunDetails()
idempotencyKey
to the invoke()
method to deduplicate invocations. This is useful when you want to make sure that a job is only invoked once for a given payload.
callbackUrl
to the invoke()
method to get notified when the job run is complete, either successfully or with an error.
POST
request to the URL with the RunNotification payload.
X-Trigger-Signature-256
header, which contains a HMAC signature of the payload using your secret API Key.
context
object to the invoke()
method, which will be available in the job run context. This is useful for passing additional information to the job run that doesn’t make sense in the payload.
invoke()
method takes a string as the first argument. This is because under the hood invoke()
is automatically creating a Task and the "⚡"
string is the cacheKey
for the created task. You can easily see the run created via the Run Dashboard:
Job.invoke()
is called within another job, and you don’t include the cacheKey
we’ll
throw an error.invokeAndWaitForCompletion()
will wait for the job run to complete for up to 60 minutes. You can change this by passing a timeoutInSeconds
option:
invokeAndWaitForCompletion
is a RunNotification object.
options
object to each invocation, if you want to pass context
and accountId
to each invocation: