Skip to main content
zerotal

Documentation


Documentation / @zerotal/notifications / SlackMessage

Interface: SlackMessage

Defined in: notifications/src/SlackChannel.ts:18

Payload returned by notification.toSlack().

Example

toSlack(_notifiable: Notifiable): SlackMessage {
  return {
    webhookUrl: 'https://hooks.slack.com/services/...',
    text:       `Order #${this.order.id} was shipped!`,
    // Optional Block Kit blocks for rich formatting:
    // blocks: [{ type: 'section', text: { type: 'mrkdwn', text: '...' } }],
  };
}

Properties

webhookUrl?

optional webhookUrl?: string

Defined in: notifications/src/SlackChannel.ts:23

Incoming webhook URL. Optional when the notifiable routes "slack" or config.slack.webhook is set — the message value wins over both.


text

text: string

Defined in: notifications/src/SlackChannel.ts:25

Fallback plain text (required by Slack even when blocks are present).


blocks?

optional blocks?: unknown[]

Defined in: notifications/src/SlackChannel.ts:27

Optional Block Kit blocks for rich formatting.