Subscription to an event
Function hooks/subscribe (http://<DOMAIN>/api/hooks/subscribe/)
Parameters:
token - authorization key obtained through the auth function
- event - event name
- order_created - event triggered when a user places an order or shop admin creates an order in the admin panel
- user_signup - event triggered at user registration
request_call_me - event triggered when a callback request is made
- target_url - link where data should be sent when the event is triggered
Response:
id - hook identifier to be stored for unsubscribing from the webhook
Also, on successful subscription to the webhook, the server will return the HTTP/1.1 201 Created header, which means that the webhook was successfully created. For server response statuses other than 20x, it should be assumed that the subscription failed.
Maximum number of subscriptions per event is 5. When this limit is reached, the server response will be "Subscriptions limit for current event has been reached"
Example of a query to http://<DOMAIN>/api/hooks/subscribe/
{ "token": "<YOUR TOKEN>", "event": "order_created", "target_url": "http://your_crm.com/order/created" }
Example of a response to a query:
{ "id": 1 }