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.
- TypeScript
- JavaScript
- Python
await ctx.notify({
message: "A charge of $500 was refunded",
title: "Refund over threshold",
delivery: [
{
to: "#interval-notifications",
method: "SLACK",
},
{
to: "foo@example.com",
},
],
});
await ctx.notify({
message: "A charge of $500 was refunded",
title: "Refund over threshold",
delivery: [
{
to: "#interval-notifications",
method: "SLACK",
},
{
to: "foo@example.com",
},
],
});
await ctx.notify(
message="A charge of $500 was refunded",
title="Refund over threshold",
delivery=[
{
"to": "#interval-notifications",
"method": "SLACK",
},
{
"to": "foo@example.com",
},
],
)

- TypeScript
- JavaScript
- Python
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
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
delivery
Optional
Iterable[DeliveryInstruction]
List of indended recipients for the notification.
class DeliveryInstruction(TypedDict):
to: str
method: NotRequired[Literal["EMAIL", "SLACK"]]
message
Required
str
Body text of the notification.
title
Optional
str
Title text identifying the notification. This will be included in the subject for email notifications.
Returns
None
Was this section useful?