twitter-webhooks
БесплатноЗапускает вложенные скриптыНе проверенReceive and verify X (Twitter) webhooks from the X Activity API and the Account Activity API. Use when setting up X webhook handlers, answering the CRC…
от hookdeck★ 104 звезды на GitHubОб этом скилле
Twitter / X Webhooks
X delivers activity to a webhook you register with the V2 Webhooks API
(POST /2/webhooks). Two products deliver to it:
- X Activity API (XAA), the current product: one subscription per event type
and user, each event wrapped in a
dataenvelope withdata.event_type. - Account Activity API (AAA): one all-activity subscription per user,
payloads keyed by activity (
tweet_create_events, ...). X says AAA reaches end of life on February 28, 2027.
Your public HTTPS endpoint must do two things:
- Answer the CRC (Challenge-Response Check). X sends a
GETwith acrc_tokenquery parameter when the webhook is created, onPUT /2/webhooks/:webhook_id, and periodically. Reply with a JSONresponse_token, or X marks the webhook invalid and stops delivering. - Verify POST deliveries against the signature header before processing.
Both use the same primitive: sha256= + base64(HMAC-SHA256(secret, message)).
The secret is your app's OAuth 2.0 client secret (recommended), or its
OAuth 1.0 consumer secret (API Secret Key) for an app that only has that.
Never the bearer token or a user access token.
When to Use This Skill
- How do I receive X (Twitter) webhooks?
- How do I respond to the X CRC /
crc_tokenchallenge? - How do I verify
X-Twitter-Webhooks-Signature-OAuth2orX-Twitter-Webhooks-Signature? - How do I handle
post.create,like.createordm.receivedevents? - How do I handle both Account Activity API and X Activity API payloads during migration?
- Why is my X webhook marked invalid / why did delivery stop?
Verification (core)
| Header | Keyed with |
|---|---|
X-Twitter-Webhooks-Signature-OAuth2 |
OAuth 2.0 client secret (recommended) |
X-Twitter-Webhooks-Signature |
OAuth 1.0 consumer secret (legacy) |
An app with only a client secret receives only the OAuth2 header; one with only a consumer secret receives only the legacy header; one with both may receive both. Accept a match on any header you hold the secret for:
const crypto = require('crypto');
// sha256= + base64(HMAC-SHA256(secret, message))
function buildSignature(message, secret) {
return 'sha256=' + crypto.createHmac('sha256', secret).update(message).digest('base64');
}
function safeEqual(a, b) {
const left = Buffer.from(a);
const right = Buffer.from(b);
return left.length === right.length && crypto.timingSafeEqual(left, right);
}
// CRC GET: reply { response_token: buildSignature(crc_token, clientSecret || consumerSecret) }
// POST: compare against the raw body, never re-serialised JSON
function verifyTwitterSignature(rawBody, headers, { clientSecret, consumerSecret }) {
return [
[headers['x-twitter-webhooks-signature-oauth2'], clientSecret],
[headers['x-twitter-webhooks-signature'], consumerSecret],
].some(([sig, secret]) => typeof sig === 'string' && !!secret && safeEqual(sig, buildSignature(rawBody, secret)));
}
Note: X's signature has no timestamp, and X publishes no retry schedule. X says an event can arrive more than once, so deduplicate and make handlers idempotent. Return
200within 10 seconds.
For complete handlers with tests, see examples/express/, examples/nextjs/, examples/fastapi/.
Telling Events Apart
X's migration guide: AAA payloads have a top-level for_user_id, and XAA
payloads have a top-level data.event_type. Route on whichever is present.
XAA data.event_type |
Fires when | AAA payload key |
|---|---|---|
post.create |
The subscribed user posts, replies, quotes or reposts | tweet_create_events |
post.mention.create / post.reply.create |
Another account mentions or replies to the user | tweet_create_events |
post.delete |
The user deletes a Post | tweet_delete_events |
like.create |
The user likes a Post, or one of theirs is liked | favorite_events |
follow.follow / follow.unfollow |
A follow or unfollow by or of the user | follow_events (type is follow / unfollow) |
dm.received / dm.sent |
An unencrypted DM is received or sent | direct_message_events |
oauth.revoke |
A user revokes your app (no subscription needed) | user_event |
XAA also has profile updates, encrypted XChat (chat.*), mutes, blocks, Spaces,
broadcasts, paid subscriptions and news.new.
For the full event reference, see references/overview.md and X's event payloads.
Environment Variables
# OAuth 2.0 Client Secret (X Developer Console -> your App -> Keys and tokens)
TWITTER_CLIENT_SECRET=your_client_secret_here
# Optional, legacy: OAuth 1.0 consumer secret (API Secret Key)
TWITTER_CONSUMER_SECRET=
Local Development
X's xurl tool can open a temporary
webhoo
Установить twitter-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл twitter-webhooks?
Receive and verify X (Twitter) webhooks from the X Activity API and the Account Activity API. Use when setting up X webhook handlers, answering the CRC (Challenge-Response Check) crc_token request, debugging the X-Twitter-Webhooks-Signature-OAuth2 or X-Twitter-Webhooks-Signature HMAC-SHA256 check, or handling events like post.create, like.create, follow.follow, dm.received, tweet_create_events and direct_message_events.
Как установить скилл twitter-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл twitter-webhooks запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic