Skip to main content
POST
/
api
/
webhookSubscriptions.create
Create a webhook subscription
curl --request POST \
  --url https://{notifuseDomain}/api/webhookSubscriptions.create \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "workspace_id": "ws_1234567890",
  "name": "Production Webhook",
  "url": "https://api.example.com/webhooks/notifuse",
  "event_types": [
    "contact.created",
    "contact.updated"
  ],
  "custom_event_filters": {
    "goal_types": [
      "purchase",
      "subscription"
    ],
    "event_names": [
      "orders/fulfilled",
      "payment.succeeded"
    ]
  }
}
'
{
"subscription": {
"id": "whsub_a1b2c3d4e5f6",
"name": "Production Webhook",
"url": "https://api.example.com/webhooks/notifuse",
"secret": "whsec_a1b2c3d4e5f6g7h8i9j0",
"settings": {
"event_types": [
"contact.created",
"contact.updated",
"email.sent"
],
"custom_event_filters": {
"goal_types": [
"purchase",
"subscription"
],
"event_names": [
"orders/fulfilled",
"payment.succeeded"
]
}
},
"event_types": [
"contact.created",
"contact.updated",
"email.sent"
],
"custom_event_filters": {
"goal_types": [
"purchase",
"subscription"
],
"event_names": [
"orders/fulfilled",
"payment.succeeded"
]
},
"enabled": true,
"last_delivery_at": "2024-01-15T10:30:00Z",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}

Authorizations

Authorization
string
header
required

API token for authentication

Body

application/json
workspace_id
string
required

The ID of the workspace

Example:

"ws_1234567890"

name
string
required

Human-readable name for the subscription

Required string length: 1 - 255
Example:

"Production Webhook"

url
string<uri>
required

The HTTPS URL to receive webhook events

Example:

"https://api.example.com/webhooks/notifuse"

event_types
string[]
required

List of event types to subscribe to

Minimum array length: 1
Example:
["contact.created", "contact.updated"]
custom_event_filters
object

Optional filters for custom_event.* event types

Response

Webhook subscription created successfully

subscription
object

A webhook subscription that receives HTTP callbacks when events occur