我正在使用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后获取接收的收据数据?
截至目前,此功能尚未实现,在即将推出的部分以及iOS / Android SDK中已提及