Hooks¶
Getting hooks list¶
- GET /api/v2/hooks¶
Example request:
GET /api/v2/hooks?domain=demo.domain.com X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImUyNjU2OWQ1LWJlMjYtNDg2Yy05ZDY1LWMwMGU2MWQ2OTNjNSIsImV4cCI6MTUwMTg4MDQwMDAwMCwiZCI6ImRlbW8ud2ViaXRlbC5jb20iLCJ0IjoiZG9tYWluIiwidiI6Mn0.nqUnTAi-L_VTxUYDoK8QqSYkclDST5PRMaRlBg8M3hQ
Example response:
{ "status": "OK", "data": [ { "_id": "59802a53a7ec15000c40926a", "domain": "demo.webitel.com", "event": "CHANNEL_CREATE", "enable": true, "description": "", "action": { "type": "web", "method": "POST", "url": "https://requestb.in/yoe4hwyo" }, "fields": [], "map": {}, "filter": {}, "headers": {}, "auth": { "headers": {}, "map": {}, "enabled": false }, "customBody": false, "rawBody": "" } ] }
- Request Headers
X-Key and X-Access-Token – Auth Token
- Parameters
domain_name (string) – Domain name is required
- Status Codes
200 OK – No error
400 Bad Request – Bad request
CURL example:
curl -XGET -H 'X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImUyNjU2OWQ1LWJlMjYtNDg2Yy05ZDY1LWMwMGU2MWQ2OTNjNSIsImV4cCI6MTUwMTg4MDQwMDAwMCwiZCI6ImRlbW8ud2ViaXRlbC5jb20iLCJ0IjoiZG9tYWluIiwidiI6Mn0.nqUnTAi-L_VTxUYDoK8QqSYkclDST5PRMaRlBg8M3hQ' "https://pre.webitel.com/engine/api/v2/hooks?domain=demo.domain.com"
Create a hook¶
- POST /api/v2/hooks¶
Example request:
HTTP/1.1 200 OK POST /api/v2/hooks?domain=demo.domain.com Content-Type: application/json X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImUyNjU2OWQ1LWJlMjYtNDg2Yy05ZDY1LWMwMGU2MWQ2OTNjNSIsImV4cCI6MTUwMTg4MDQwMDAwMCwiZCI6ImRlbW8ud2ViaXRlbC5jb20iLCJ0IjoiZG9tYWluIiwidiI6Mn0.nqUnTAi-L_VTxUYDoK8QqSYkclDST5PRMaRlBg8M3hQ
{ "event": "CUSTOM->engine::dialer_member_end", "enable": true, "description": "Dialer’s member was complited", "action": { "type": "web", "method": "POST", "url": "https://requestb.in/yoe4hwyo" }, "customBody": true, "rawBody": "{ \"dlr_id\": \"${dialerId}\", \"member_id\": \"${id}\", \"end_cause\": \"${endCause}\" }", "auth": { "headers": {}, "map": {}, "enabled": false }, "map": {}, "filter": {}, "fields": [], "headers": { "Content-Type": "application/json" } }
Example response:
{"status":"OK","data":{"result":{"ok":1,"n":1},"ops":[{"domain":"demo.webitel.com","event":"CUSTOM->engine::dialer_member_end","enable":true,"description":"Dialer’s member was complited","action":{"type":"web","method":"POST","url":"https://requestb.in/yoe4hwyo"},"fields":[],"map":{},"filter":{},"headers":{"Content-Type":"application/json"},"auth":{"headers":{},"map":{},"enabled":false},"customBody":true,"rawBody":"{\n\"dlr_id\": \"${dialerId}\",\n\"member_id\": \"${id}\",\n\"end_cause\": \"${endCause}\"\n}","_id":"598035b7a7ec15000c40926e"}],"insertedCount":1,"insertedIds":["598035b7a7ec15000c40926e"]}}
- Request Headers
Content-Type – application/json
X-Key and X-Access-Token – Auth Token
- Parameters
domain_name (string) – Domain name is required
- Status Codes
200 OK – No error
400 Bad Request – Bad request