Twitter to Discord Webhook: Step-by-Step Setup Guide (2026)

Complete tutorial for routing real-time Twitter/X alerts into Discord channels with webhooks, code examples, and rich embed formatting.

Why Route Twitter Alerts to Discord?

Discord is where crypto teams live. Trading rooms, alpha channels, and execution dashboards all run on Discord. When an influencer tweets a contract address or a whale moves tokens, the alert needs to land in the same workspace where your team acts on it — not in a separate app or email inbox.

By routing Twitter/X alerts to Discord via webhooks, you get instant notifications with rich formatting in the channels your team already monitors. No context switching, no missed signals.

What Is a Discord Webhook?

A Discord webhook is a URL that accepts HTTP POST requests and posts messages into a specific channel. You do not need a bot account, OAuth tokens, or gateway connections. Just send JSON to the URL and the message appears in the channel.

Webhook URL format: https://discord.com/api/webhooks/{webhook.id}/{webhook.token}

Discord webhooks support plain text messages, rich embeds (with titles, colors, fields, images, and footers), file attachments, and up to 10 embeds per message.

Step 1: Create a Discord Webhook

  1. Open your Discord server and navigate to the channel where you want alerts
  2. Click the gear icon (Edit Channel) next to the channel name
  3. Go to Integrations → Webhooks → New Webhook
  4. Name the webhook (e.g., 'Twitter Alerts') and optionally set an avatar
  5. Click 'Copy Webhook URL' — save this URL securely
  6. Click Save

Keep your webhook URL private. Anyone with the URL can post messages to your channel.

Step 2: Understand the Payload Format

Discord webhooks accept a JSON payload with two main fields: content for plain text and embeds for rich formatted messages. For trading alerts, embeds are preferred because they support structured data, color-coding, and inline fields.

Step 3: Send Alerts with Node.js

const WEBHOOK_URL = 'https://discord.com/api/webhooks/YOUR_ID/YOUR_TOKEN';

async function sendTweetAlert(tweet) {
  const embed = {
    title: `@${tweet.author.handle}`,
    description: tweet.text,
    color: 3447003, // Blue
    url: `https://x.com/${tweet.author.handle}/status/${tweet.id}`,
    fields: [],
    footer: { text: 'TweetStream Alert' },
    timestamp: new Date().toISOString(),
  };

  // Add detected tokens as fields
  if (tweet.tokens?.length) {
    for (const token of tweet.tokens) {
      embed.fields.push({
        name: token.symbol,
        value: `$${token.price} | ${token.chain}`,
        inline: true,
      });
    }
  }

  const response = await fetch(WEBHOOK_URL, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ embeds: [embed] }),
  });

  if (response.status === 429) {
    const retryAfter = response.headers.get('Retry-After');
    console.log(`Rate limited. Retry after ${retryAfter}s`);
  }
}

Step 4: Send Alerts with Python

import requests
import time

WEBHOOK_URL = "https://discord.com/api/webhooks/YOUR_ID/YOUR_TOKEN"

def send_tweet_alert(tweet: dict) -> None:
    embed = {
        "title": f"@{tweet['author']['handle']}",
        "description": tweet["text"],
        "color": 3447003,  # Blue
        "url": f"https://x.com/{tweet['author']['handle']}/status/{tweet['id']}",
        "fields": [],
        "footer": {"text": "TweetStream Alert"},
    }

    # Add detected tokens
    for token in tweet.get("tokens", []):
        embed["fields"].append({
            "name": token["symbol"],
            "value": f"${token['price']} | {token['chain']}",
            "inline": True,
        })

    payload = {"embeds": [embed]}
    resp = requests.post(WEBHOOK_URL, json=payload)

    if resp.status_code == 429:
        retry_after = resp.json().get("retry_after", 1)
        time.sleep(retry_after)
        requests.post(WEBHOOK_URL, json=payload)

Rich Embed Formatting for Trading Alerts

Discord embeds support extensive formatting. Here are the key fields for trading alerts:

  • title — The alert headline (e.g., account name or token symbol)
  • description — The tweet text or alert body
  • color — Decimal color value (green: 3066993, red: 15158332, blue: 3447003)
  • fields — Name/value pairs for structured data (token, price, chain)
  • footer — Timestamp or source attribution
  • thumbnail — Small image (e.g., token logo or user avatar)
  • url — Link back to the original tweet

Discord Webhook Rate Limits

Discord enforces webhook rate limits and returns HTTP 429 with a Retry-After value when you send too quickly. Exact limits can vary by route and context, so build around the response headers instead of hard-coding one universal number.

For high-volume alert channels, implement these strategies:

  • Queue messages and send in batches rather than one-at-a-time
  • Use multiple webhooks across different channels for different alert types
  • Respect Retry-After when you receive 429 responses
  • Bundle multiple alerts into a single message using multiple embeds (up to 10 per message)
  • Treat response headers as the source of truth for retry timing

Troubleshooting Common Issues

  • Webhook returns 401 Unauthorized — The webhook URL has been deleted or regenerated. Create a new webhook.
  • Messages not appearing — Check that the webhook is assigned to the correct channel and the bot has Send Messages permission.
  • Embeds not rendering — Verify your JSON structure. The embeds field must be an array, even for a single embed. Color must be a decimal number, not hex.
  • Rate limited (429) — Slow down your request rate. Queue messages and implement backoff.
  • Content too long — Embed descriptions are limited to 4,096 characters. Total embed content across all embeds must not exceed 6,000 characters.

The Easy Way: TweetStream Discord Delivery

If you do not want to build and maintain a webhook pipeline yourself, TweetStream delivers alerts directly to Discord with zero code. Configure your accounts and webhooks in the dashboard, and TweetStream handles filtering, enrichment (OCR, token detection, live prices), formatting, and delivery. See the Discord crypto alerts page for setup details.

Frequently Asked Questions

TweetStream Team

Last updated: April 2026

Start real-time Twitter WebSocket alerts today

WebSocket delivery, OCR, and token detection - no infrastructure to build.

Start 7-Day Trial

From $199/mo · Basic/Elite 7-day trial · OCR + token detection included

Related Pages