Skip to content

Subscribing

Jezz Santos edited this page Mar 27, 2017 · 10 revisions

Subscribers to webhook events raised by your services will need to:

  1. Creating an public internet endpoint to received the webhook event.
  2. Create a webhook subscription to those events, configured with the URL of the public internet endpoint. (by calling POST /webhooks/subscriptions)
  3. Handle the POSTed request in the public internet endpoint, and do whatever they like with the event and the specific event's data.

To subscribe to a webhook, you would POST the following, to the subscription service:

POST /webhooks/subscriptions
{
    "name": "My Webhook",
    "events": ["hello", "goodbye"],
    "config": {
        "url": "http://myserver/api/incoming",
    }
}

Where 'hello' and 'goodbye' are the names of the published events raised by that service. Where the config.url is a POST public internet endpoint.

Security

By providing a config.secret in the registration, you can request that events are raised to your service securely.

POST /webhooks/subscriptions
{
    "name": "My Webhook",
    "events": ["hello", "goodbye"],
    "config": {
        "url": "http://myserver/api/incoming",
        "secret": "mybase64encodedsecret"
    }
}

See Subscriber Security for more details.

Clone this wiki locally