Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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_meevent 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 201Created что означает, что вебхук успешно создан. При других статусах ответа сервера, отличных от 20х, следует считать, что подписка не удалась.Максимальное количество подписок на одно событие - 5. При достижении этого лимита ответ сервера будет  header, which means that the webhook was successfully createdFor server response statuses other than 20x, it should be assumed that the subscription failed.

Maximum number of subscriptions per event is 5When 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/

Code Block
languagejs
titleJSON
{
	"token": "<ВАШ<YOUR ТОКЕН>TOKEN>",
	"event": "order_created",
	"target_url": "http://your_crm.com/order/created"
}


Пример ответа на запросExample of a response to a query:

Code Block
languagejs
titleJSON
{
    "id": 1
}

...