Webhooks

RelayRail uses webhooks to receive SMS responses and handle billing events.

Overview

When a user responds to an SMS, Telnyx sends a webhook to RelayRail. Similarly, Stripe sends webhooks for billing events. These are handled automatically by the RelayRail backend.

Note: If you're self-hosting RelayRail, you'll need to configure these webhooks. For managed service users, webhooks are pre-configured.

Telnyx Webhooks

Telnyx sends webhooks when:

  • An SMS is received (user response)
  • An SMS delivery status changes
  • Message delivery fails

Webhook URL

https://relayrail.dev/api/webhooks/telnyx

Payload Example

{
  "data": {
    "event_type": "message.received",
    "payload": {
      "from": {
        "phone_number": "+15129877876"
      },
      "to": [
        { "phone_number": "+16232780262" }
      ],
      "text": "YES"
    }
  }
}

Stripe Webhooks

Stripe sends webhooks for:

  • Subscription created/updated/canceled
  • Payment succeeded/failed
  • Invoice events

Webhook URL

https://relayrail.dev/api/webhooks/stripe

Self-Hosting Configuration

If self-hosting, configure your webhook URLs in:

  • Telnyx: Messaging Profile settings
  • Stripe: Developers → Webhooks

Ensure your server is publicly accessible and uses HTTPS.

Security

  • -All webhooks are verified using provider signatures
  • -Invalid signatures are rejected
  • -Webhook secrets are stored securely