Twitter to Discord Bot
Build a Twitter/X to Discord bot with TweetStream WebSocket events, Discord embeds, keyword filters, and retry-safe webhook delivery.
Direct answer
A Twitter/X to Discord bot should consume TweetStream WebSocket events, filter high-signal posts, and send retry-safe Discord embeds.
Flow
The core flow is simple: TweetStream receives the post, your service filters it, and Discord receives the formatted alert.
- Open the TweetStream WebSocket
- Filter by account, keyword, or detected token
- Format a Discord embed
- Send through webhook or bot API
Reliability
Keep Discord delivery outside the WebSocket callback so rate limits and retries do not block source event handling.
Implementation asset: adaptable code example
Use this router before building Discord embeds or bot messages. Adapt the terms, tracked accounts, and destination to your own routing rules.
const watchTerms = ["listing", "launch", "contract", "exploit"];
const destination = "discord-bot";
export function routeDiscordBotAlert(event: {
d?: {
author?: string;
detected?: { tokens?: Array<unknown> };
ocr?: string;
text?: string;
};
}) {
const text = `${event.d?.text ?? ""} ${event.d?.ocr ?? ""}`.toLowerCase();
const matchedTerm = watchTerms.find((term) => text.includes(term.toLowerCase()));
const hasTokenSignal = Boolean(event.d?.detected?.tokens?.length);
return {
author: event.d?.author,
deliver: Boolean(matchedTerm || hasTokenSignal),
destination,
matchedTerm,
};
}Why implement this with TweetStream
You can build this workflow from raw APIs, polling, and custom scraping, but TweetStream is the better starting point when speed, structured payloads, token/OCR enrichment, and reliable WebSocket delivery matter. Start the 3-day trial and route your first high-signal accounts into your alerting or trading flow.
Start 3-day trialQuestions
Start real-time Twitter WebSocket alerts today
WebSocket delivery, OCR, and token detection - no infrastructure to build.
Start 3-Day TrialFrom $199/mo · Basic/Elite 3-day trial · OCR + token detection included
