Back to Reflex

Webhooks

docs/ai_builder/webhooks.md

0.9.8a11.7 KB
Original Source

Webhooks

Use an outgoing webhook when an event in your app should send data to a service that provides an incoming webhook URL.

Create and store the webhook

  1. Create an incoming webhook in the destination service.
  2. Copy its URL.
  3. Store the URL in Secrets with a descriptive name such as SIGNUP_WEBHOOK_URL.

Treat the URL as a credential. Do not paste it into chat, source code, logs, screenshots, or client-side code.

Describe the event and payload

Tell the agent when to send the webhook, which fields to include, and how to handle failures:

text
After a user completes signup, POST their internal user ID, plan name, and
signup timestamp to the URL in SIGNUP_WEBHOOK_URL. Do not include passwords,
tokens, or profile fields. Use the destination's documented JSON format.

Specify whether a failed webhook should block the user action, retry in the background, or only record an error. For important events, request idempotency or another duplicate-delivery safeguard supported by the destination.

Test the webhook

Use test credentials and non-sensitive sample data first. Verify:

  • The event sends exactly once under normal conditions.
  • The payload matches the destination's expected schema.
  • Timeouts and non-success responses are handled without exposing the URL.
  • Retries do not create duplicate records or notifications.