Skip to main content

Notify Webhook

Send a notification to Slack, Discord, Teams, or any webhook URL.

Reference: loha/notify-webhook@v1

Category: deploy

Runtime: curlimages/curl:8.5.0 (non-root, digest-pinned)

License: Apache-2.0

When to use​

Use this step for ChatOps notifications outside Thailand or for any webhook endpoint that accepts JSON. Choose WEBHOOK_FORMAT to match the target platform; payload shape differs.

Parameters​

ParameterTypeDefaultRequiredDescription
WEBHOOK_URLstring—YesWebhook URL for Slack, Discord, Teams, or custom endpoint.
MESSAGEstring—YesMessage body to send.
STATUSenum: success, failure, infosuccessNoBuild status: success, failure, or info.
TITLEstringPipeline NotificationNoNotification title shown in the attachment or embed.
COLORstring#36a64fNoAttachment color for Slack/Discord (hex code). Defaults to green.
WEBHOOK_FORMATenum: slack, discord, teams, rawslackNoWebhook payload format: slack, discord, teams, or raw.

Workspaces​

No workspaces required. This task only makes outbound calls.

Results​

ResultDescription
NOTIFY_RESULTNotification result (sent or failed)
HTTP_STATUSHTTP response status code from the webhook endpoint

How it works​

POSTs to WEBHOOK_URL with a JSON body shaped per WEBHOOK_FORMAT. slack produces an Incoming Webhook payload with attachments; discord produces an Embed; teams produces an Office 365 connector card; raw posts the raw MESSAGE body unchanged. The HTTP response code is exposed as HTTP_STATUS.

Examples​

Slack on success​

steps:
- name: notify-slack
uses: loha/notify-webhook@v1
with:
WEBHOOK_URL: '$(secrets.SLACK_WEBHOOK_URL)'
MESSAGE: 'Build $(context.pipelineRun.name) completed successfully'
STATUS: 'success'
TITLE: 'Pipeline Build'
WEBHOOK_FORMAT: 'slack'

Discord notification​

steps:
- name: notify-discord
uses: loha/notify-webhook@v1
with:
WEBHOOK_URL: '$(secrets.DISCORD_WEBHOOK_URL)'
MESSAGE: 'Build failed! Check the pipeline logs.'
STATUS: 'failure'
WEBHOOK_FORMAT: 'discord'

Troubleshooting​

Problem: HTTP 400 from Slack.

Solution: Use an Incoming Webhook URL (https://hooks.slack.com/services/...) and make sure WEBHOOK_FORMAT: slack. App-token-style URLs are not webhooks and will reject the payload.


Problem: Discord returns HTTP 204 but the message never appears in the channel.

Solution: 204 is Discord's success response: NOTIFY_RESULT will be sent. If the message is missing, the bot lacks "Send Messages" permission in the target channel.