Skip to content

workers-builds-notifications-template: Fix empty Discord webhook messages#956

Open
JoshuaKirby88 wants to merge 1 commit intocloudflare:mainfrom
JoshuaKirby88:workers-builds-notifications-fixes
Open

workers-builds-notifications-template: Fix empty Discord webhook messages#956
JoshuaKirby88 wants to merge 1 commit intocloudflare:mainfrom
JoshuaKirby88:workers-builds-notifications-fixes

Conversation

@JoshuaKirby88
Copy link

Summary

Fixes webhook payload formatting so Discord Slack-compatible webhooks don’t reject messages with:

400 {"message":"Cannot send an empty message","code":50006}

Changes

  • Add top-level text to Slack payload type and message builders.
  • Ensure sendSlackNotification always sends a fallback text ("Workers Build Notification"), even when only blocks are
    present.
  • Keep README subscription wording aligned with actual Worker Build subscription scope.

Copilot AI review requested due to automatic review settings February 18, 2026 11:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Discord webhook integration by adding a top-level text field to Slack-formatted payloads, preventing the "Cannot send an empty message" error from Discord's Slack-compatible webhook endpoint. The changes ensure all webhook messages include a fallback text field, which is required by Discord but optional for Slack.

Changes:

  • Added text field to SlackPayload interface and all message builder functions with descriptive values including emojis
  • Enhanced error logging in sendSlackNotification to include the sent payload for easier debugging
  • Clarified README documentation to specify that queue subscriptions are per-worker, not for all workers in the account

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
workers-builds-notifications-template/src/slack.ts Added optional text field to SlackPayload interface; updated all message builders to return descriptive text values; ensured fallback text in sendSlackNotification; improved error logging
workers-builds-notifications-template/README.md Clarified that --worker-name in subscriptions refers to the source worker being built, not the consumer worker; updated architecture diagram and test instructions to reflect per-worker subscription scope

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +237 to +240
const body = JSON.stringify({
...payload,
text: payload.text || "Workers Build Notification",
});
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new top-level text field added to fix Discord webhook compatibility is not covered by tests. Consider adding test assertions to verify that the text field is present in the payload sent to the webhook and contains the expected values for different event types (success, failure, cancelled, fallback).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments