raspery

Send CI and deploy alerts to a team channel with webhooks

When a deploy fails at 6 p.m., the worst place to find out is an email you read the next morning. The best place is the channel where your team is already talking about the release, where someone can react, reply in a thread and pick it up.

Incoming webhooks make that a five-minute job. A webhook is a secret URL that belongs to a channel: anything that can send an HTTP request (a CI pipeline, a deploy script, a cron job) can post a message to that channel by calling it. This guide walks through setting one up in Raspery and wiring it into the tools you probably already use. Raspery webhooks are also Slack-compatible, so a tool that can already post to a Slack webhook can often post to Raspery with no script at all.

Webhooks are included in every Raspery plan, including Free.

Step 1: Create the webhook

  1. Open the channel that should receive the messages, for example #deploys.
  2. Open the channel menu and choose Integrations.
  3. Click New webhook, give it a name such as "GitHub Actions" or "Production deploys", and optionally upload an avatar.
  4. Copy the webhook URL. It looks like https://raspery.app/api/hooks/….
  5. Click Send test message to check that it arrives.

Workspace admins can add webhooks to a channel, and so can the people who manage that channel. Webhooks live in channels; direct messages don't have them. You can create as many as you like, one per tool is a good habit.

Treat the URL like a password: anyone who has it can post to the channel. We'll come back to that in keeping the URL safe.

Step 2: Send your first message

The quickest test is curl from a terminal. Store the URL in an environment variable so it doesn't end up in your shell history or your scripts:

export RASPERY_WEBHOOK_URL="https://raspery.app/api/hooks/…"

curl -sS -X POST "$RASPERY_WEBHOOK_URL" \
  -H 'Content-Type: application/json' \
  -d '{"content": "✅ **Deploy finished** on `main`"}'

The message appears in the channel straight away, under the webhook's name and an App badge, so nobody mistakes it for a person. The request body is JSON with up to three fields:

  • content (required): the message text, up to 10,000 characters. Use \n for a new line.
  • username (optional): the name to show on this message. Defaults to the webhook's name; handy when one webhook serves several environments.
  • preview (optional): set to true to show a preview of the first link. Off by default, which keeps alert channels compact.

A richer example:

{
  "content": "📦 **Pipeline finished** on `main`\n- build: ✅ success\n- deploy: ✅ success\nhttps://ci.example.com/pipelines/42",
  "username": "Release bot"
}

The text supports the same formatting as messages you type: **bold**, *italic*, `code`, code blocks with three backticks, > quotes, lists and headings. Emoji can be pasted as they are or written as codes such as :white_check_mark:.

Step 3: Post from GitHub Actions

Add the URL as a repository secret (Settings → Secrets and variables → Actions) named RASPERY_WEBHOOK_URL. Then add a step at the end of the job you care about. With if: always() it reports both successes and failures:

- name: Notify the channel
  if: always()
  run: |
    curl -sS -X POST "${{ secrets.RASPERY_WEBHOOK_URL }}" \
      -H 'Content-Type: application/json' \
      -d "{\"content\": \"${{ job.status == 'success' && '✅' || '❌' }} **${{ github.workflow }}** ${{ job.status }} on \`${{ github.ref_name }}\` · ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"

The message links straight to the run, so whoever sees a ❌ is one click away from the logs.

Step 4: Post from GitLab CI

Add the URL as a CI/CD variable (Settings → CI/CD → Variables), marked masked and protected. Then add two small jobs in the .post stage, one for success and one for failure. The job image needs curl:

notify-success:
  stage: .post
  when: on_success
  script:
    - 'curl -sS -X POST "$RASPERY_WEBHOOK_URL" -H "Content-Type: application/json" -d "{\"content\":\"✅ **Pipeline passed** on \`$CI_COMMIT_REF_NAME\` · $CI_PIPELINE_URL\"}"'

notify-failure:
  stage: .post
  when: on_failure
  script:
    - 'curl -sS -X POST "$RASPERY_WEBHOOK_URL" -H "Content-Type: application/json" -d "{\"content\":\"❌ **Pipeline failed** on \`$CI_COMMIT_REF_NAME\` · $CI_PIPELINE_URL\"}"'

Or without touching the pipeline

GitLab can also post project events (pipelines, pushes, merge requests) on its own:

  1. In the project, open Settings → Integrations and choose Mattermost notifications.
  2. Paste the Raspery webhook URL into Webhook. Leave Username empty to use the webhook's name.
  3. Pick the events to send and save.
  4. Click Test settings to check that a message arrives.

Step 5: Post from Argo CD

For GitOps deploys, Argo CD Notifications can call the webhook when an application syncs. Put the URL in argocd-notifications-secret under the key raspery-webhook-url, then configure the service, a template and a trigger in argocd-notifications-cm:

service.webhook.raspery: |
  url: $raspery-webhook-url
  headers:
  - name: Content-Type
    value: application/json
template.app-sync-succeeded: |
  webhook:
    raspery:
      method: POST
      body: |
        {"content": "✅ **{{.app.metadata.name}}** synced · {{.context.argocdUrl}}/applications/{{.app.metadata.name}}"}
trigger.on-sync-succeeded: |
  - when: app.status.operationState.phase in ['Succeeded']
    send: [app-sync-succeeded]

Then subscribe an application with an annotation:

notifications.argoproj.io/subscribe.on-sync-succeeded.raspery: ""

Slack-compatible: use your tools' built-in notifications

Many CI, monitoring and deployment tools can send notifications to a Slack incoming webhook. They post JSON with text, blocks or attachments fields (some older tools use a payload form field). The Raspery webhook URL accepts that format too, so you can often paste it into the tool's Slack, Mattermost or "incoming webhook" setting and skip the script entirely. GitLab's Mattermost notifications above work this way.

This works wherever the tool asks you for a webhook URL. Integrations that make you install a Slack app and sign in to Slack talk to Slack directly, so they can't post to Raspery.

Slack formatting (bold, italic, code, lists) is converted, :emoji: codes become emoji, and a username in the message is shown as the sender. A link with its own text shows as the text followed by the address. Buttons that open a link become links, and other buttons are left out. Colour bars aren't shown, and images appear as links.

Responses and limits

If you're scripting against the webhook, these are the responses to handle:

  • 200: posted. The body is {"id": "…"} (a plain ok for Slack-format messages, as Slack itself answers).
  • 400: the body couldn't be read, or the message is empty.
  • 404: unknown URL. Check it, or it has been regenerated.
  • 429: an hourly limit was reached. Wait for the number of seconds in the Retry-After header.

There are two hourly limits: one per webhook, and one for all the webhooks in the workspace together. At the time of writing they're 60 messages per hour per webhook and 1,000 per hour per workspace. The Integrations panel shows how much of this hour each webhook has used. Messages longer than 10,000 characters aren't rejected; they're shortened, so a long build log never makes you lose the alert itself.

Keeping the URL safe

  • Keep it in your tool's secret settings: GitHub secrets, masked GitLab variables, Kubernetes secrets. Never commit it to a repository.
  • One webhook per tool. If one leaks, you replace one URL, not all of them.
  • If a URL leaks, regenerate it from the webhook's page in Integrations. The old URL stops working immediately; update the secret in your tool and you're done.

Making alerts useful, not noisy

A channel that fills up with green ticks soon gets muted, and then the red ones get missed too. A few habits keep alerts worth reading:

  • Post on change, not on every run. A failure, and the first success after it, is usually all a team needs. Nightly jobs can report only when they fail.
  • Give alerts their own channel. Keep #deploys or #alerts separate from discussion channels, and let people decide how closely they follow it.
  • Always link to the details: the run, the pipeline or the dashboard. The message is a signpost, not the log.
  • Use username to tell sources apart, for example "Deploy · staging" and "Deploy · production".

Because webhook messages are ordinary messages in the channel, the rest of Raspery works on them too. React with 👀 to show you're looking, reply in a thread to keep the investigation in one place, pin the incident while it's open, or turn the failure into a task with an owner and a due date, without leaving the conversation.

More from the blog