Skip to main content

ctx.notify

Sends a custom notification to Interval users via email or Slack. To send Slack notifications, you'll need to connect your Slack workspace to the Interval app in your organization settings.

await ctx.notify({
message: "A charge of $500 was refunded",
title: "Refund over threshold",
delivery: [
{
to: "#interval-notifications",
method: "SLACK",
},
{
to: "foo@example.com",
},
],
});

delivery

Optional

DeliveryInstruction[]

List of intended recipients for the notification.
delivery: {
// Address or handle of the recipient. Can be an email address, or a Slack handle or channel.
to: string;
// Delivery method by which to send the notification. Defaults to the preferred notification method(s) configured by the recipient, or email if none set.
method?: "EMAIL" | "SLACK";
}[]

message

Required

string

Body text of the notification.

title

Optional

string

Title text identifying the notification. This will be included in the subject for email notifications.

Returns

null