adding-inbound-webhooks
БесплатноБез исполняемых скриптовНе проверенUse when adding a webhook endpoint for a third party that sends to PostHog, adding an inbound webhook consumer for a provider that already has an endpoint, or…
от PostHog★ 41 278 звёзд на GitHubОб этом скилле
Adding an inbound webhook
Every webhook a third party sends to PostHog goes through posthog/ingress/.
Read posthog/ingress/README.md for the transport contract and the package reference.
This skill is the decision tree and the checklists.
Which job are you doing?
- The provider already has an endpoint (see the Endpoints table in
posthog/ingress/README.md) and you want to react to its events: add a consumer. - No endpoint exists for this third party, or the semgrep rule flagged a hand-rolled verifier: add a provider, then add its consumer.
- Outbound call to a vendor API, which is the other direction:
/routing-outbound-api-calls.
Before you migrate a verifier, read what the existing code verifies with.
A verifier the vendor ships in its SDK, or one from a maintained library, stays as it is: it is written by the people who define the scheme, and a reimplementation only adds bugs.
Ingress wraps such a verifier at most. Only a hand-rolled hmac check is a migration.
Add a consumer
A product declares its consumers in products/<product>/backend/webhook_consumers.py, in a WEBHOOK_CONSUMERS sequence of WebhookConsumer values from posthog.ingress.contracts.
products/stamphog/backend/webhook_consumers.py is the smallest complete example.
WEBHOOK_CONSUMERS = (
WebhookConsumer(
name="stamphog_review",
provider="github",
app="stamphog",
event_types=frozenset({"pull_request"}),
handler=_run_review,
),
)
Rules that decide whether this works:
nameis unique per provider and is part of the dedup cache key. Treat it as fixed once it ships: renaming one lets a redelivery run the consumer a second time.providerandappmust match aProviderSpecsome incarnation declares, andevent_typesmust be a subset of what that app declares. Anything else raisesRegistryErrorwhen the registry is built, rather than sitting there looking registered and never running.handlertakes oneWebhookDeliveryand returns nothing. Its return value is ignored and never decides the HTTP status. A handler that raises does cost the request its receipt when the provider setsretry_status, which is how a consumer whose durable record is written inside the handler gets the delivery again.- Keep the module cheap to import. The registry imports it on the first delivery through
load_product_modules("webhook_consumers"), so defer heavy imports into the handler behind# noqa: PLC0415with a reason. - The handler runs synchronously inside the request. Enqueue a task for real work, the way stamphog and conversations do.
- A handler that reads the database wraps the read in
bounded_statement_timeout(ms, models=...)fromposthog.ingress.dispatch.database, passing only the models the read actually uses. Opening an alias is itself unbounded, so naming one the read never touches can stall the delivery on connection setup. - Hoglint's
webhook-consumers-use-facaderule lets the module import product backend code only through a facade, its own or another product's. Reach product internals through the facade. The rule covers every product that has awebhook_consumers.py, including relative imports. - A consumer whose resources are split across regions declares
ownership=, pointing at a facade function that returns aDeliveryOwnership. Ingress forwards the signed request when the answer isELSEWHERE, and dispatches locally either way. The lookup runs inside the request, so bound it withbounded_statement_timeout(ms, models=...). Let a transient error out of the lookup rather than answeringLOCALorUNDECIDEDthrough it: a lookup that raises asks a provider withretry_statusfor the delivery again, and a guessed answer receipts a delivery the other region never sees. - A GitHub consumer cannot get its project from
installation.id, because one installation can link to several projects. Read Picking the project for the two allowed shapes.
Tests: extend the product's existing webhook test module rather than starting a parallel one.
products/stamphog/backend/tests/test_webhook_consumers.py is the shape: drive the real view with a signed RequestFactory request and assert the enqueue, plus the event type the app does not register, the bad signature, the unparseable body, the non-POST, and the missing secret.
Reset the process-cached registry and the dedup cache between tests with reset_consumer_registry() and cache.clear().
Add a provider
Create posthog/ingress/<provider>/ with an __init__.py and a provider.py.
Copy github/ for the full shape, or pandadoc/ for a small one.
Copy the layout, not the behavior: a provider package holds only what is specific to its third party. A need that a second provider could share becomes a lane, a scheme option or a WebhookProvider attribute, the way `retry_statu
Установить adding-inbound-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл adding-inbound-webhooks?
Use when adding a webhook endpoint for a third party that sends to PostHog, adding an inbound webhook consumer for a provider that already has an endpoint, or migrating a hand-rolled hmac verifier that the `inbound-webhooks-go-through-ingress` semgrep rule flags. Covers the two jobs separately: a consumer in `products/<product>/backend/webhook_consumers.py`, and a provider incarnation under `posthog/ingress/<provider>/` wired with `build_webhook_view()`. Carries the rules that are easy to get wrong: a consumer name is a dedup cache key, event types must be declared by the provider app or the registry raises, and the module stays cheap to import. Trigger terms: add a webhook, webhook consumer, inbound webhook, hand-rolled hmac, inbound-webhooks-go-through-ingress.
Как установить скилл adding-inbound-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл adding-inbound-webhooks запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic