1.9 KiB
1.9 KiB
Create/Subscribe to Webhook
Purpose of the POST Webhook create API
Use this API to create a new webhook for a user.
This API differs from our others in that it's both interactive and does not return a Standard Envelope. These are the steps required to complete a webhook subscription.
- The consumer (you) makes a POST request to the provider (the API host) to
http://apihost.com/webhook/subscribe
with the required parameters. - The provider makes a GET request back to your
callback
URL passing along amode
,topic
, andchallenge
parameter. AverifyToken
parameter is passed back if originally supplied. - The consumer must validate that the subscription was intended (typically using the
verifyToken
) and print out thechallenge
value with a HTTP 200 response code. - If the consumer response is a HTTP 200 and the content body was equal to
challenge
then the provider completes the subscription.
Endpoint
Authentication: required
POST /webhook/subscribe
Parameters
- callback (required), A URL to POST to. This also needs to handle GET calls for the verification process.
- topic (required), i.e. photo.upload - The topic which you'd like to subscribe to.
- mode (required), Only sync is supported at this time.
- verifyToken (optional), A provider generated string to which is passed back as part of the verification process.