Image Description Image Description

No Results

  • Support
Logo Logo v1.0
  • Basics
  • Getting started
  • Get authenticating user
  • Products
  • Create a Product
  • License Keys
  • Verify a License Key
  • Redeem a License Key
  • Refund a License Key
  • Subscriptions
  • Verify a Subscription
  • Webhooks
  • Basics
  • Subscribe
  • Unsubscribe
  • Webhook Events
  • New sale
  • New lead
  • New affiliate sign-up
  • New subscription
  • Subscription cancellation

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:
    1. sale - This is when a customer buys something (money is transacted).
    2. lead - This is when a customer submits their name and email (free products/lead magnets).
    3. affiliate - This is when an affiliate signs up or accepts your affiliate invite.
    4. subscription - This is when a customer subscribes to a subscription product (free trial or otherwise).
    5. 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,
    }