【发布时间】:2019-10-01 10:27:41
【问题描述】:
我想一次向多个设备发送推送通知。我可以传递令牌数组吗? 可以使用google api吗?请帮我解决这个问题。
request(
{
method: 'POST',
uri:
'https://fcm.googleapis.com/v1/projects/projectId/messages:send',
headers: {
'content-type': 'application/json',
Authorization: `Bearer ${token}`,
'apns-priority': 'high',
content_available: true
},
body: {
message: {
token: token,
notification: {
body: 'This is an FCM notification message!',
title: 'FCM Title'
},
android: {
notification: {
sound: 'default'
}
}
}
},
json: true
},
async function(error, response, body) {
if (error) {
console.log(error);
}
console.log(body);
}
);
【问题讨论】:
标签: node.js push-notification firebase-cloud-messaging google-cloud-messaging google-api-client