Subscribe to a Webhook
You can programmatically subscribe to a webhook.
This creates a workflow object for your brand, with the trigger and webhook URL that you specify.
Endpoint
POST /webhooks/subscribe
Required parameters
-
trigger
- The trigger event for your workflow, values can be:sale
- This is when a customer buys something (money is transacted).lead
- This is when a customer submits their name and email (free products/lead magnets).affiliate
- This is when an affiliate signs up or accepts your affiliate invite.subscription
- This is when a customer subscribes to a subscription product (free trial or otherwise).cancel
- This is when a current subscriber cancels their subscription to a subscription product.
webhook_url
- The webhook URL for which you intend to create a workflow
Example request
curl https://api.zylvie.com/webhooks/subscribe \
-h "Authorization: Bearer e97f0aafe4884bc380c81fdb2347dc55" \
-d "trigger=sale" \
-d "webhook_url=https://https://hooks.zapier.com/hooks/catch/18690100/3n4iof0/" \
-X POST \
Example response
The returned JSON will be a workflow object.
If a workflow with the same webhook URL already exists, it will simply return the pre-existing workflow object.
Otherwise it creates a new workflow object with the given parameters.
{
"name": "https://https://hooks.zapier.com/hooks/catch/18690100/3n4iof0/", //Same as webhook URL
"trigger": "sale",
"webhook": "https://https://hooks.zapier.com/hooks/catch/18690100/3n4iof0/",
"signing_secret": "5021f1f06993493ba23e817e247141cd",
"is_live": true,
}