Notification
To understand more concepts of notification in Siren, you can visit this page.
Sending a message/notification
We could send a notification to a specific receiver by passing a receiver_id
in the path params and correct payload format in the body. The payload format needs to follow receiver type contract.
Example: Sending Notification to Slack
Assuming there is a slack receiver registered in Siren with ID 51
. Sending to that receiver would require us to have a payload.data
that have the same format as the expected slack payload format.
payload:
data:
channel: siren-devs
text: an alert or notification
icon_emoji: ":smile:"
attachments:
- blocks:
- type: section
text:
type: mrkdwn
text: |-
New Paid Time Off request from <example.com|Fred Enriquez>
<https://example.com|View request>
- CLI
- HTTP
$ siren receiver send --id 51 --file payload.yaml
$ curl --request POST
--url http://localhost:8080/v1beta1/receivers/51/send
--header 'content-type: application/json'
--data-raw '{
"payload": {
"data": {
"channel": "siren-devs",
"text": "an alert or notification",
"icon_emoji": ":smile:"
"attachments": [
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "New Paid Time Off request from <example.com|Fred Enriquez>
<https://example.com|View request>"
}
}
]
]
}
}
}'
Above end the message to channel name #siren-devs
with payload.data
in slack payload format.
Alerts Notification
For all incoming alerts via Siren hook API, notifications are also generated and published via subscriptions. Siren will match labels from the alerts with label matchers in subscriptions. The assigned receivers for all matched subscriptions will get the notifications. More details are explained here.
Siren has a default template for alerts notification for each receiver. Go to the Receivers section to explore the default template defined by Siren.