分类

订阅

订阅 – 回调数据

以下列出了请求对象体的样例,不同的事件发生时会接收到url

NewCall

{
“account”: “demo”,
“caller_id_name”: “Demo”,
“caller_id_number”: “16471230000”,
“destination_number”: “16471234567”,
“event”: “NewCall”,
“event_time”: “2017-03-23T21:47:07Z”,
“id”: “4b847e58-2324-4f1c-8385-754769c46b1c”,
“start_time”: “2017-03-23T21:47:07Z”
}

EnterQueue

{
“account”: “demo”,
“caller_id_name”: “Demo”,
“caller_id_number”: “16471230000”,
“destination_number”: “16471234567”,
“event”: “EnterQueue”,
“event_time”: “2017-03-23T21:47:07Z”,
“id”: “4b847e58-2324-4f1c-8385-754769c46b1c”,
“queue”: “receptionists”,
“start_time”: “2017-03-23T21:47:07Z”
}

Ringing

{
“account”: “demo”,
“agent”: “rcp1”,
“caller_id_name”: “Demo”,
“caller_id_number”: “16471230000”,
“destination_number”: “16471234567”,
“event”: “Ringing”,
“event_time”: “2017-03-23T21:50:20Z”,
“id”: “c6537a05-71ea-4572-8bb1-790518268fdf”,
“queue”: “receptionists”,
“start_time”: “2017-03-23T21:50:21Z”
}

Answer

{
“account”: “demo”,
“agent”: “rcp1”,
“caller_id_name”: “Demo”,
“caller_id_number”: “16471230000”,
“destination_number”: “16471234567”,
“event”: “Answer”,
“event_time”: “2017-03-23T21:50:23Z”,
“id”: “c6537a05-71ea-4572-8bb1-790518268fdf”,
“queue”: “receptionists”,
“start_time”: “2017-03-23T21:50:21Z”
}

Hangup

{
“account”: “demo”,
“caller_id_name”: “Demo”,
“caller_id_number”: “16471230000”,
“destination_number”: “16471234567”,
“end_time”: “2017-03-23T21:47:17Z”,
“event”: “Hangup”,
“event_time”: “2017-03-23T21:47:17Z”,
“id”: “4b847e58-2324-4f1c-8385-754769c46b1c”,
“queue”: “receptionists”,
“agent”: “agent1”,
“start_time”: “2017-03-23T21:47:07Z”
}

GetSMS

{
“messageId”: “SMS_SM06745ab9f08b4945c5e197a32ac1b402”,
“from”: “16471230000”,
“to”: “14165784567”,
“text”: “Hiii”,
“charge”: 15,
“time”: “2017-11-24T21:54:02.098Z”
}

订阅 – 获取全部订阅

GET

/api/subscriptions

权限:订阅

Header

字段类型描述
Content-Type字符串应用或JSON

成功 200

字段类型描述
event字符串事件类型,值为以下数值之一 [“NewCall”, “EnterQueue”, “Ringing”, “Answer”, “Hangup”, “GetSMS”]
id字符串唯一编号
type字符串[“json”, “slack”, “slack_debug”]
url字符串回调URL

成功响应

HTTP/1.1 200 OK
[{
“event”: “Answer”,
“id”: “00c8c9d716800419549f27166397925b”,
“url”: “http://example.com/callback/answer”
},
{
“event”: “NewCall”,
“id”: “00c8c9d716800419549f271663975995”,
“type”: “slack”,
“url”: “https://hooks.slack.com/services/M9HG5EF/M9HG5EF/2RqG3GsC5996HyqywGmsUi51M”
},
{
“event”: “Ringing”,
“id”: “00c8c9d716800419549f271663978f5b”,
“url”: “http://example.com/callback/ringing”
}]

订阅 – 添加新的回调

POST

/api/subscription

权限:订阅

Header

字段类型描述
Content-Type字符串应用或JSON

参数

字段类型描述
url字符串回调 URL
event字符串事件类型,值为以下数值之一 [“NewCall”, “EnterQueue”, “Ringing”, “Answer”, “Hangup”, “GetSMS”]
type字符串[“json”, “slack”, “slack_debug”]

请求样例

/api/subscription
{
“url”: “http://example.com/callback/answer”,
“event”: “Answer”,
“type”: “slack”
}

成功 200

字段类型描述
created布尔型是否已创建成功
id字符串唯一编号

成功响应

HTTP/1.1 201 Created
{
“created”: true,
“id”: “93d643732028cb7ef3f42b899fe26cb3”
}

订阅 – 删除订阅

DELETE

/api/subscription/:id

权限:订阅

Header

字段类型描述
Content-Type字符串应用或JSON

参数

字段类型描述
id字符串唯一编号

请求样例

/api/subscription/93d643732028cb7ef3f42b899fe26cb3

成功 200

字段类型描述
deleted布尔型是否已删除

成功响应

HTTP/1.1 200 OK
{
“deleted”: true
}

上一页 联系人
下一页 账号
Table of Contents