-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Problem
The Slack webhook implementation documentation contains two bugs in the example app.js code that prevent messages from being sent to Slack:
1. ReferenceError: body is not defined (Line 118)
In the slackMessage object, the code uses:
text: body,However, the variable body is never defined. The extracted variable from the request is body_markdown (defined on line 92). This causes a ReferenceError when the code runs.
Fix: Change line 118 to:
text: body_markdown,2. Invalid header block text type (Line 122)
The header block uses an invalid text type:
{
type: "header",
text: { type: "mrkdwn", text: title_markdown },
},According to Slack's Block Kit API, header blocks only support plain_text as the text type, not mrkdwn. This causes the Slack API to reject the message with error: "must be a valid enum value [json-pointer:/blocks/0/text/type]"
Fix: Change line 122 to:
text: { type: "plain_text", text: title_markdown },Impact
These errors prevent the webhook from successfully sending notifications to Slack users, making the feature non-functional.
Proposed Solution
Update the documentation at docs/admin/monitoring/notifications/slack.md with the corrected code examples.