【发布时间】:2020-03-02 00:32:03
【问题描述】:
我正在使用 Twilio 通知服务向 APN 和 FCM 发送推送通知。对于我们一次发送给大量用户的情况,我们希望切换到直通 API。但是,我没有在响应中得到 to_binding 字段,所以不知道有多少成功或失败。当使用identity 发送时,我们会得到一个身份数组。
这是我们发送的内容:
twilio_client.notify.v1.services(ENV.fetch('TWILIO_NOTIFY_SERVICE')).notifications.create(
to_binding: params[:users],
body: params[:body],
title: params[:title],
data: {data: @data},
fcm: {
data: {
title: params[:title],
body: params[:body]
}
}
)
我在设备上收到通知,但这是我收到的:
{"body": "stuff", "sound": null, "sms": null, "alexa": null, "facebook_messenger": null, "tags": [], "title": "My Title", "segments": [], "ttl": 545435, "gcm": null, "account_sid": "account_id", "priority": "high", "apn": null, "data": {"data": {"a_thing": 995, "type": "My Type", "id": 4344}}, "sid": "myid", "action": null, "date_created": "2019-11-05T15:25:27Z", "service_sid": "service_id", "identities": [], "fcm": {"data": {"body": "stuff", "title": "My Title"}}}
在文档 (https://www.twilio.com/docs/notify/api/notification-resource?code-sample=code-send-a-notification-to-bindings-in-the-request-1&code-language=Ruby&code-sdk-version=5.x) 的示例中,看起来应该返回一个 toBindings 字段。
有没有办法让它工作,或者有什么方法可以在使用通知 ID 后获取收到的收据数据?
【问题讨论】:
标签: push-notification twilio twilio-api