Skip to main content

Discord Integration

Discord is the primary destination type in Dispatch. Events are delivered as rich embed messages to Discord channels.

Setting Up a Discord Destination​

Option 1: Manual Webhook URL​

  1. In Discord, go to Server Settings → Integrations → Webhooks
  2. Create a new webhook and copy the URL
  3. In Dispatch, go to Destinations → Create Destination
  4. Select Discord as the type and paste the webhook URL

Option 2: OAuth Connection​

  1. Go to Destinations → Connect Discord
  2. Authorize the Dispatch bot for your server
  3. Select a channel
  4. Dispatch creates the webhook automatically

Discord Embed Format​

Dispatch delivers events as Discord webhook messages with rich embeds:

{
"content": "",
"username": "Dispatch",
"avatar_url": "",
"embeds": [
{
"title": "push",
"description": "3 commits pushed to main",
"color": 555146,
"fields": [
{
"name": "Repository",
"value": "owner/repo",
"inline": true
},
{
"name": "Branch",
"value": "main",
"inline": true
}
],
"footer": {
"text": "Dispatch"
},
"timestamp": "2025-03-14T10:30:00Z"
}
]
}

Embed Limits​

Discord enforces these limits on embed content:

FieldMax Length
Title256 characters
Description4096 characters
Fields25 per embed
Field name256 characters
Field value1024 characters
Footer text2048 characters
Author name256 characters

Colors​

Embed colors are specified as decimal integers. Common values:

ColorDecimalHex
Red16711680#FF0000
Green65280#00FF00
Blue255#0000FF
Aqua (Dispatch)555146#08788A
Purple10181046#9B59B6
Yellow16776960#FFFF00

ANSI Formatting​

Discord supports ANSI color codes in code blocks. Dispatch templates provide helper functions for ANSI formatting:

{{ansiGreen "SUCCESS"}}    → Green text
{{ansiRed "ERROR"}} → Red text
{{ansiYellow "WARNING"}} → Yellow text
{{ansiBold "Important"}} → Bold text

These are rendered inside Discord's ANSI code block syntax (ansi language identifier).

Rate Limiting​

Discord enforces rate limits on webhook endpoints. Dispatch handles this automatically:

  • Cooldown — per-destination cooldown period tracked across all delivery workers
  • Retry-After — respects Discord's Retry-After header on 429 responses

If Discord returns a 429, the delivery is automatically retried after the specified cooldown period.

Security​

  • Webhook URLs are encrypted at rest
  • URLs are only decrypted at delivery time and are never exposed in API responses or logs

Thread Support​

Dispatch can deliver messages to a specific Discord thread rather than the main channel.

Destination-level thread​

Set a thread on the destination itself (in Create Destination or Edit Destination). All messages delivered through that destination will be posted to the specified thread.

For destinations connected via OAuth, Dispatch shows a searchable dropdown of all active threads in your server, grouped by channel. Select the thread and the name is saved alongside the ID.

For destinations added by pasting a webhook URL directly, enter the thread ID manually. To find a thread ID in Discord, right-click the thread and select Copy Thread ID (requires Developer Mode to be enabled in Discord settings).

Per-rule thread override​

You can also set a thread on individual routing rules. The rule-level thread takes precedence over the destination-level one, so you can route different event types to different threads. The same searchable picker is available on the routing page for OAuth-connected destinations.

Example:

Default thread: #deployments   (all events go here by default)

Routing rule:
body.action = "deploy"
→ Deliver, thread: #production-deploys (deploys go to a separate thread)