Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

threads-webhooks

БесплатноЗапускает вложенные скриптыНе проверен

Receive and verify Threads (Meta) webhooks. Use when setting up Threads webhook handlers, completing the GET hub.challenge handshake, debugging…

hookdeckот hookdeck★ 104 звезды на GitHub

Об этом скилле

Threads Webhooks

Threads webhooks use the Meta webhook mechanism: a one-time GET handshake when you save the Callback URL, then POST deliveries signed with X-Hub-Signature-256. They do not follow the Standard Webhooks spec. The shared Meta pattern is documented in facebook-webhooks and whatsapp-webhooks.

When to Use This Skill

  • How do I receive Threads webhooks?
  • How do I verify Threads webhook signatures with X-Hub-Signature-256?
  • How do I complete the Threads hub.challenge verification handshake?
  • Why is my Threads webhook signature verification failing?
  • How do I handle Threads replies, mentions, publish, or delete notifications?

Two Requests, Two Jobs

  1. GET: handshake. Meta sends hub.mode=subscribe, hub.verify_token and hub.challenge. If the token matches the one you set in the App Dashboard, reply 200 with the raw hub.challenge as plain text.
  2. POST: event delivery. A JSON body signed with X-Hub-Signature-256.

Verification (core)

Meta sends X-Hub-Signature-256: sha256=<hex>, the HMAC-SHA256 hex digest of the raw request body keyed with your Threads App Secret. Require and strip the sha256= prefix, check the digest is exactly 64 hex characters (Buffer.from(x, 'hex') silently truncates invalid hex), and compare in constant time.

Which secret? Threads apps have two. Meta's getting-started guide only says "App Secret", but a live Threads notification (tested 2026-11-18) is signed with the Threads App Secret (Use cases > Customize > Settings in the Threads API use case), not the Meta App Secret under App settings > Basic.

Node:

const crypto = require('crypto');

function verify(rawBody, signatureHeader, appSecret) {
  const match = /^sha256=([0-9a-f]{64})$/i.exec(signatureHeader || '');
  if (!match || !appSecret) return false;
  const expected = crypto.createHmac('sha256', appSecret).update(rawBody).digest('hex');
  return crypto.timingSafeEqual(Buffer.from(match[1].toLowerCase()), Buffer.from(expected));
}

Python:

import hmac, hashlib, re

def verify(raw_body: bytes, signature_header: str, app_secret: str) -> bool:
    match = re.fullmatch(r"sha256=([0-9a-fA-F]{64})", signature_header or "")
    if not match or not app_secret:
        return False
    expected = hmac.new(app_secret.encode(), raw_body, hashlib.sha256).hexdigest()
    # bytes on both sides: a non-ASCII header gives 401, not a TypeError/500
    return hmac.compare_digest(match.group(1).lower().encode(), expected.encode())

In Express, read the body with express.raw({ type: '*/*' }) so every content type reaches the verifier as unparsed bytes.

For complete handlers with the GET handshake, event dispatch, and tests, see:

Common Event Types

Threads notifications are a flat object. values holds the change: Meta's docs show one { field, value } object, but a live publish notification (tested 2026-11-18) sent an array of them, so handle both. The event is each change's field; topic groups fields into moderate or interaction.

Field (values[].field) Topic Triggered When
replies moderate A reply is posted on a Threads post owned by the installing user
delete moderate The authenticated user deletes a post
mentions interaction A public post mentions the installing user
publish interaction The authenticated user publishes a post (including replies)
{
  "app_id": "123456",
  "topic": "moderate",
  "target_id": "78901",
  "time": 1723226877,
  "subscription_id": "234567",
  "has_uid_field": false,
  "values": [
    {
      "field": "replies",
      "value": { "id": "8901234", "username": "test_username", "text": "Reply", "replied_to": { "id": "567890" } }
    }
  ]
}

Important Headers

Header Description
X-Hub-Signature-256 sha256=<hex> HMAC-SHA256 of the raw body keyed with the Threads App Secret
X-Hub-Signature Legacy sha1=<hex> HMAC-SHA1 with the same key; verify the SHA-256 header instead

Environment Variables

THREADS_APP_SECRET=your_threads_app_secret  # Threads App Secret, not the Meta App Secret
THREADS_VERIFY_TOKEN=your_verify_token   # For a direct callback, use the token entered in Meta

Setup

  1. In the App Dashboard add the Threads API use case, then under Use Cases > Customize > Settings add the Get real-time notifications with Threads Webhooks sub-use case.
  2. Select a topic, click **Subscribe to this object
Полный SKILL.md на GitHub

Установить threads-webhooks в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

examples/express/.env.exampleexamples/express/README.mdexamples/express/package.jsonexamples/express/src/index.jsexamples/fastapi/.env.exampleexamples/fastapi/README.mdexamples/fastapi/main.pyexamples/fastapi/requirements.txtexamples/fastapi/test_webhook.pyexamples/nextjs/.env.exampleexamples/nextjs/README.mdexamples/nextjs/app/webhooks/threads/route.tsexamples/nextjs/package.jsonexamples/nextjs/vitest.config.tsreferences/overview.mdreferences/setup.mdreferences/verification.md

FAQ

Что делает скилл threads-webhooks?

Receive and verify Threads (Meta) webhooks. Use when setting up Threads webhook handlers, completing the GET hub.challenge handshake, debugging X-Hub-Signature-256 signature verification, or handling replies, mentions, publish, and delete notifications.

Как установить скилл threads-webhooks?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл threads-webhooks запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить threads-webhooks с