ctx.notify allows you to send notifications from your Workflows. Currently supported channels are email and slack.
ctx.notify will not pause the workflow, if you would like to do so see Human in the Loop.The notification input defined here is the same as what is passed to Interrupt.approval().
Usage
The following example shows how to send a notification from a workflow
Email
Emails will be delivered from no-reply@workflows.inferable.ai
deleteUserWorkflow.version(1).define(async (ctx, input) => {
ctx.notify({
message: "Hello from this workflow!",
destination: {
type: "email",
// The email address to notify
email: "test@example.com",
},
});
//...
});
Slack
If enabled, the Slack integration can also be used to notify users / channels.
deleteUserWorkflow.version(1).define(async (ctx, input) => {
ctx.notify({
message: "Hello from this workflow!",
destination: {
type: "slack",
// The email address of the Slack user to notify
email: "test@example.com",
// Or Slack user ID
userId: "U0123456789",
// Or Slack channel ID
channelId: "C0123456789",
},
});
//...
});