Slack Provider Overrides (and Blocks)
Our create notifications endpoint allows you to customize the payload sent to Slack by setting notification.overrides
.
The notification.overrides.slack
parameter accepts all the body parameters of Slack's chat.postMessage API.
Provider-specific parameters in notification.overrides
take precedence over the ones specified in notification
.
Example: Slack Blocks
Here's how you would translate the Stacking multiple blocks example from the Slack docs:
<Snippets
params={{
notification: {
recipients: [
{
email: '[email protected]',
},
],
title: 'New PTO Request',
content: 'Fred has requested PTO from Aug 10 - Aug 13',
overrides: {
providers: {
slack: {
blocks: [
{
type: 'header',
text: {
type: 'plain_text',
text: 'New request',
},
},
{
type: 'section',
fields: [
{
type: 'mrkdwn',
text: 'Type:\nPaid Time Off',
},
{
type: 'mrkdwn',
text: 'Created by:\n<example.com|Fred Enriquez>',
},
],
},
{
type: 'section',
fields: [
{
type: 'mrkdwn',
text: 'When:\nAug 10 - Aug 13',
},
],
},
{
type: 'section',
text: {
type: 'mrkdwn',
text: '<https://example.com|View request>',
},
},
],
},
},
},
},
}}
/>