WebSocket Token API

Overview

WebSocket Token API is used to connect external systems and is an alternative to webhooks.

Connection addresses:

  • /ws/token/v1/:TOKEN, where :TOKEN is the value of the token_local field of the integration_point entity.

  • /ws/token/v1 passing the header "Authorization: Bearer TOKEN", where TOKEN is the value of the token_local field of the integration_point entity.

Requires configuring the WebSocket connection for specific APIs available to external systems and matching the connection point by the configured roles (the opts.filter_capabilities field of the integration_point entity).

Connection information

Request for connection information
[
  "connection_info",
  {
    "qid":930293482233
  }
]
Response
[
  "connection_info_result",
  {
    "qid":123,
    "result":"ok",
    "site":"main_site",
    "ownertype":"token",
    "domain":"test.rootdomain.ru",
    "sessionid":"6a0c530c-017d-960e-e3d6-7cd30a921f58",
    "connectionid":"b26c45b1-017d-960e-e3d5-7cd30a921f58",
    "capabilities":["test","callrecord","ccs","ivrapi","rest","svcscript"],
    "datetime":"2021-12-07T18:47:00.003Z",
    "timestamp":1638902820003,
    "integration_point_id":"c75f0231-016b-8f20-af65-1c1b0d69174c",
    "integration_point_type":"public",
    "roles":["admin"],
    "token":"a55c54b59ee6c8cfab2f83e33c2474d3"
  }
]

Available Token APIs

  • rest - managing system classes (static and dynamic).

  • dmsbatch - batch execution of REST requests to a dynamic class.

  • dmsquery - executing an arbitrary read query.

  • subscr - subscribing to system events sent by the wssubscr role.

  • ivrapi - external control of IVR scripts.

  • ccs - access to call and device control functions.

  • callrecord - access to conversation recordings.

  • svcscript - starting a handler of an arbitrary service script in the domain.

  • snmp - sending an arbitrary SNMP trap to the SNMP server configured in the master domain.

  • quota - plugin for working with the access quota service.

  • msg - sending arbitrary messages by the server into WebSocket connections from scripts.

Plugins implementing other arbitrary Token APIs and corresponding capabilities are also supported.