我正在使用RingCentral FaxOut API提交传真。该响应中的传真状态为"已排队"。是否有任何订阅来获取该邮件的更新传真状态。RingCentral 博客提到了使用对其 API 的 GetMessage 调用来获取最新状态。
https://www.ringcentral.com/blog/2015/02/know-fax-transmission-api-succeeded/
他们确实有用户状态的推送通知。https://github.com/ringcentral/ringcentral-js
首先,有一个较旧的FaxOut API,然后是较新的RingCentral Platform API Message-Fax资源。后者是我将在这里解决的问题,如果您使用的是前一个版本,请与 RingCentral 创建一个支持案例以寻求帮助。
不太好的消息是,没有直接的方法使用推送通知(订阅(来接收您正在寻找的特定传真状态数据,但能够监视邮件存储事件,并过滤传入数据EVENT_DATA.changes.type === 'Fax'。
了解如何在订阅中使用message-store
事件筛选器:https://developers.ringcentral.com/api-docs/latest/index.html#!#RefGetMessageEvent
此外,我在 Node 中创建了一个演示应用程序.js向开发人员展示了如何创建订阅(它使用您在问题中引用的 JavaScript SDK(:https://github.com/bdeanindy/ringcentral-subscription-basics(您可以在.env
文件中设置配置参数来指示要使用的事件过滤器(。
这是我从 RingCentral 发送传真出站时的订阅事件流。请注意事件过滤器,其中之一是订阅message-store
这是使用 API 的开发人员可以使用传真消息的地方(我在事件的每个阶段上方添加了简单的注释(:
Succesfully logged into the RC Account
EVENT FILTERS: [ '/account/~/extension/2557490012',
'/account/~/extension/2557490012/presence?detailedTelephonyState=true&aggregated=true',
'/account/~/extension/2557490012/message-store',
'/account/~/extension/2557490012/presence/line',
'/account/~/extension/2557490012/message-store/instant?type=SMS' ]
SUBSCRIPTION CREATED SUCCESSFULLY
Fax Sent
SUBSCRIPTION NOTIFICATION.....
{ uuid: '8004a0b2-7907-458b-8a9b-ec1ba3202f5e',
event: '/restapi/v1.0/account/2557490012/extension/2557490012/message-store',
timestamp: '2016-09-30T22:43:53.762Z',
subscriptionId: 'bd6a307b-a05f-4421-acc5-85f093aae2b3',
body:
{ extensionId: 2557490012,
lastUpdated: '2016-09-30T22:43:43.902+0000',
changes: [ { type: 'Fax', newCount: 1, updatedCount: 0 }, [length]: 1 ] } }
Waiting to connect
SUBSCRIPTION NOTIFICATION.....
{ uuid: '627d3cdf-1638-4029-9e0b-94bbf3325c61',
event: '/restapi/v1.0/account/2557490012/extension/2557490012/message-store',
timestamp: '2016-09-30T22:44:13.776Z',
subscriptionId: 'bd6a307b-a05f-4421-acc5-85f093aae2b3',
body:
{ extensionId: 2557490012,
lastUpdated: '2016-09-30T22:44:01.879+0000',
changes: [ { type: 'Fax', newCount: 0, updatedCount: 1 }, [length]: 1 ] } }
SUBSCRIPTION NOTIFICATION.....
{ uuid: 'f1e1310e-11c7-479d-b988-087379bdcad3',
event: '/restapi/v1.0/account/2557490012/extension/2557490012/message-store',
timestamp: '2016-09-30T22:44:23.769Z',
subscriptionId: 'bd6a307b-a05f-4421-acc5-85f093aae2b3',
body:
{ extensionId: 2557490012,
lastUpdated: '2016-09-30T22:44:15.565+0000',
changes: [ { type: 'Fax', newCount: 0, updatedCount: 1 }, [length]: 1 ] } }
Waiting to have sent confirmation
SUBSCRIPTION NOTIFICATION.....
{ uuid: '2148d2d9-8e05-4adc-8019-518774187116',
event: '/restapi/v1.0/account/2557490012/extension/2557490012/message-store',
timestamp: '2016-09-30T22:45:33.767Z',
subscriptionId: 'bd6a307b-a05f-4421-acc5-85f093aae2b3',
body:
{ extensionId: 2557490012,
lastUpdated: '2016-09-30T22:45:21.232+0000',
changes: [ { type: 'Fax', newCount: 0, updatedCount: 1 }, [length]: 1 ] } }
但是,如何确定传真是否已发送、排队或失败?使用 EVENT.event 属性获取查询中的邮件存储列表筛选: messageType=Fax&availability=Alive&direction=Outbound&messageStatus=Sent
然后,生成的邮件存储记录将有一个新项目,records
您可以使用 to.phoneNumber 匹配发起事件(HTTP POST 发送传真(。
{
"uri": "{{REMOVED_FOR_SECURITY}}",
"id": {{REMOVED_FOR_SECURITY}},
"to": [
{
"phoneNumber": "+{{REMOVED_TO_PREVENT_SPAM}}",
"name": "Hello Fax",
"messageStatus": "Sent"
}
],
"type": "Fax",
"creationTime": "2016-09-30T22:43:43.000Z",
"readStatus": "Unread",
"priority": "Normal",
"attachments": [
{
"id": {{REMOVED_FOR_SECURITY}},
"uri": "{{REMOVED_FOR_SECURITY}}",
"type": "RenderedDocument",
"contentType": "application/pdf"
}
],
"direction": "Outbound",
"availability": "Alive",
"messageStatus": "Sent",
"faxResolution": "High",
"faxPageCount": 2,
"lastModifiedTime": "2016-09-30T22:45:21.232Z",
"coverIndex": 0
}