Skip to content

Create a new webhook subscription

Request

Subscriptions are configurations that define what events you want to receive webhooks for. A url and at least one event are required for a subscription. If your server requires authorization, the authorization_header property allows you to specify what value to send in the "Authorization" http header of every delivery to your url.


More information about creating webhook subscriptions is available on the Creating Webhook Subscriptions page, and the list of available events is available on the Event List page.


The access token used when creating a subscription must have the webhooks.writeauth scope.

Security
oauth2_as_a_user(Required scopes: webhooks.write) or oauth2_as_a_server(Required scopes: webhooks.write)
Bodyapplication/json

Attributes of the webhook subscription to create.

urlstring, (url)(Webhooks.Subscription.url)

The url that will be called when delivering events for this subscription.

Example:"https://example.com/webhook"
authorization_headerstring(Webhooks.Subscription.authorization_header)

A value will be sent in every delivery as the 'Authorization' header value in the POST request.

Example:"Bearer abc123-some-token"
activeboolean(Webhooks.Subscription.active)

Whether the subscription is "turned on". Inactive subscriptions will not send deliveries to the subscription url except for ping deliveries.

Example:true
eventsArray of objects(Webhooks.Subscription.Event)
curl -i -X POST \
  https://partner.socialchorus.com/v2/webhooks/subscriptions \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://example.com/webhook",
    "authorization_header": "Bearer abc123-some-token",
    "active": true,
    "events": [
      {
        "name": "content_published",
        "version": "1"
      }
    ]
  }'

Responses

Success

Bodyapplication/json
dataobject(Webhooks.Subscription.Resource)required
Response
{ "data": { "id": "abc123", "url": "https://example.com/webhook", "authorization_header": "Bearer abc123-some-token", "active": true, "events": [], "created_at": "2000-01-01T00:00:00Z", "updated_at": "2000-01-01T00:00:00Z" } }