Subscribe to a webhook call:

curl -X POST "https://api.loyale.io/api/Webhook/Subscribe"
-H "accept: */*"
-H "X-Scheme: 8f4089bc-91b6-4078-8403-cfd07b285cdb" 
-H "Content-Type: application/json-patch+json" 
-d "{\"topic\":0,\"url\":\"string\",\"email\":\"string\"}"

X-Scheme is the Id of the scheme in which the request is being done, a GUID is passed here.
The topic has to be one from this list, the URL must start with "https:" and the email needs to be a valid email. The email is used to receive messages in case the webhooks fail.
You can have multiple subscriptions to one topic.

Unsubscribe from a webhook call:

curl -X DELETE "https://api.loyale.io/api/Webhook/Unsubscribe" 
-H "accept: */*" 
-H "X-Scheme: 8f4089bc-91b6-4078-8403-cfd07b285cdb" 
-H "Content-Type: application/json-patch+json" 
-d "{\"topic\":0,\"url\":\"string\",\"email\":\"string\"}"

Topic cannot be null in this request. If email and/or url are passed then these will be used to filter which webhook with the given topic is removed.

Get a list of all your subscribed webhooks:

curl -X GET "https://api.loyale.io/api/Webhook" 
-H "accept: text/plain" 
-H "Scheme: 8f4089bc-91b6-4078-8403-cfd07b285cdb"

This will return all of your subscribed webhooks in the following format.

[
  {
    "id": "ae395976-0a95-4504-b4cf-f1ac6fbccaf3",
    "topic": 1,
    "url": "https://example.net/updatedcustomer",
    "email": "[email protected]",
    "createdDate": "2021-12-06T16:01:49.742742Z",
    "updatedDate": "2021-12-06T16:01:49.742742Z",
    "createdBy": "System",
    "updatedBy": "System"
  },
  {
    "id": "77568ca0-1500-4f03-aae0-79d53bea3186",
    "topic": 9,
    "url": "https://example.net/suspendedcustomer",
    "email": "[email protected]",
    "createdDate": "2021-03-09T10:01:51.215756Z",
    "updatedDate": "2021-03-09T10:01:51.215756Z",
    "createdBy": "System",
    "updatedBy": "System"
  }
]

What’s Next