import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
const automationInvokeResponse = await client.automations.invoke.invokeAdHoc({
automation: {
cancelation_token: 'delay-send--user-yes--abc-123',
steps: [
{ action: 'delay', until: '20240408T080910.123' },
{ action: 'send', template: '64TP5HKPFTM8VTK1Y75SJDQX9JK0' },
],
},
data: { name: 'Foo' },
profile: { tenant_id: 'abc-123' },
recipient: 'user-yes',
});
console.log(automationInvokeResponse.runId);{
"runId": "1-65f240a0-47a6a120c8374de9bcf9f22c"
}Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a series of automation steps. For information about what steps are available, checkout the ad hoc automation guide here.
import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
const automationInvokeResponse = await client.automations.invoke.invokeAdHoc({
automation: {
cancelation_token: 'delay-send--user-yes--abc-123',
steps: [
{ action: 'delay', until: '20240408T080910.123' },
{ action: 'send', template: '64TP5HKPFTM8VTK1Y75SJDQX9JK0' },
],
},
data: { name: 'Foo' },
profile: { tenant_id: 'abc-123' },
recipient: 'user-yes',
});
console.log(automationInvokeResponse.runId);{
"runId": "1-65f240a0-47a6a120c8374de9bcf9f22c"
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Show child attributes