Webhooks

Supabase Auth Webhook

Handle Supabase Auth INSERT events for new users. Creates an enrollment subscription using matching rules or available free plans, and responds with the created subscription info.

POST
/webhooks/supabase

Authorization

bearerAuth
AuthorizationBearer <token>

Use your secret API key as the bearer token

In: header

Request Body

application/json

type*string
Value in"INSERT"
table*string
Value in"users"
record*

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.getlumen.dev/v1/webhooks/supabase" \  -H "Content-Type: application/json" \  -d '{    "type": "INSERT",    "table": "users",    "record": {      "id": "3c5c7b33-2f8c-4e85-8b9a-9af9c2d8e123",      "email": "jane@example.com",      "raw_user_meta_data": {        "first_name": "Jane",        "last_name": "Smith"      }    }  }'
{
  "received": true,
  "message": "Enrollment subscription created successfully",
  "subscription": {
    "id": "sub_int_bXpaJQwRq9e17g8c2kFYLr",
    "customerId": "cus_01j23abc456def789ghi0jklm",
    "planId": "plan_int_6FJ7xXk8Qp9zR2tSa1BcDe",
    "status": "active"
  },
  "invoice": null,
  "plan": {
    "id": "plan_int_6FJ7xXk8Qp9zR2tSa1BcDe"
  },
  "credit_grants_created": 0
}
{
  "error": "Supabase webhook processing failed: Invalid input"
}
{
  "error": "No active pricing tables found for this merchant"
}
{
  "error": "Subscription already exists for this customer",
  "subscription": {
    "id": "sub_int_bXpaJQwRq9e17g8c2kFYLr",
    "status": "active"
  }
}
{
  "error": "Failed to create enrollment subscription"
}