我正在开发一个与 aws-amplify 和 aws 移动集线器集成的反应原生应用程序。
我们目前将用户登录到 cognito。
我试图向特定的端点 ID 发送推送通知,但我看不到如何设置该端点 ID,在用于 pinpoint 的节点 js(我使用 lambda)文档中仅存在 getEnpoint,但需要 EnpointId,我找不到它在哪里。
app.post('/asdf/get/endpoint', function (req, res) {
pinpoint.getEndpoint({
ApplicationId: APP_ID_PINPOINT,
EndpointId: req.body.userId
}, (err, data) => {
if (err) {
res.json({ error: err });
} else {
res.json({ data: data });
}
});
});
如何将 enpointId (userId) 设置为已登录的用户,然后,每次我需要向他发送推送时,我只需获取该 enpoint 并向连接到它的所有设备发送推送?
或者,我必须存储来自用户(DynamoDb)的所有令牌,并分别向所有设备发送消息?(带有精确的sendMessage)