您如何订阅 Microsoft Graph 中的推送通知?
How do you subscribe to push notifications in microsoft graph?
我一直在尝试弄清楚如何使用 beta notifications 资源向 Teams 中的用户发送推送通知,但我无法通过第 1 步。
User signs in to your application, which creates a subscription with the Microsoft Graph notification service.
我没有使用 Microsoft 库支持的语言,所以我无法使用他们的 SDK。相反,我手动发送 http 请求。我已经尝试了很多,但我什至无法确定 subscription 类型中的“资源”应该是什么。以下是我尝试过的一些方法和结果:
发送此消息:
{
"changeType": "created",
"notificationUrl": "https://(...)/notifications",
"resource": "me/notifications",
"expirationDateTime": "2020-11-04T18:23:45.9356913Z"
}
结果:
{
"error": {
"code": "InvalidRequest",
"message": "Subscription for resource 'me/notifications' is not supported.",
"innerError": {
"date": "2020-11-04T17:12:24",
"request-id": "66172d3c-298d-47d4-babb-52d96ef42179",
"client-request-id": "1c20849c-fcda-0b07-56e3-5bed08bb28e4"
}
}
}
以上消息也使用此参数正确调用了我服务器的 /notifications 路由:
Validation: Testing client application reachability for subscription Request-Id: 2f3cc3b8-b2c2-5922-451c-433add43bc74
发送这个:
{
"changeType": "created",
"notificationUrl": "https://(...)/notifications",
"resource": "notification",
"expirationDateTime": "2020-11-04T18:23:45.9356913Z"
}
结果:
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'notification'.",
"innerError": {
"date": "2020-11-04T17:21:15",
"request-id": "d894c93b-9dac-4051-a3af-cb6039f1394b",
"client-request-id": "84d18ec7-2c67-8240-b576-03641b3b5a59"
}
}
}
我也试过“通知”、“users/me/notifications”和其他几个都无济于事。怎么回事,微软?在 beta 文档中甚至没有在可能的订阅类型下列出此资源,是否支持它?
在这一点上,我很确定这个功能不会work/exist。
我一直在尝试弄清楚如何使用 beta notifications 资源向 Teams 中的用户发送推送通知,但我无法通过第 1 步。
User signs in to your application, which creates a subscription with the Microsoft Graph notification service.
我没有使用 Microsoft 库支持的语言,所以我无法使用他们的 SDK。相反,我手动发送 http 请求。我已经尝试了很多,但我什至无法确定 subscription 类型中的“资源”应该是什么。以下是我尝试过的一些方法和结果:
发送此消息:
{
"changeType": "created",
"notificationUrl": "https://(...)/notifications",
"resource": "me/notifications",
"expirationDateTime": "2020-11-04T18:23:45.9356913Z"
}
结果:
{
"error": {
"code": "InvalidRequest",
"message": "Subscription for resource 'me/notifications' is not supported.",
"innerError": {
"date": "2020-11-04T17:12:24",
"request-id": "66172d3c-298d-47d4-babb-52d96ef42179",
"client-request-id": "1c20849c-fcda-0b07-56e3-5bed08bb28e4"
}
}
}
以上消息也使用此参数正确调用了我服务器的 /notifications 路由:
Validation: Testing client application reachability for subscription Request-Id: 2f3cc3b8-b2c2-5922-451c-433add43bc74
发送这个:
{
"changeType": "created",
"notificationUrl": "https://(...)/notifications",
"resource": "notification",
"expirationDateTime": "2020-11-04T18:23:45.9356913Z"
}
结果:
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'notification'.",
"innerError": {
"date": "2020-11-04T17:21:15",
"request-id": "d894c93b-9dac-4051-a3af-cb6039f1394b",
"client-request-id": "84d18ec7-2c67-8240-b576-03641b3b5a59"
}
}
}
我也试过“通知”、“users/me/notifications”和其他几个都无济于事。怎么回事,微软?在 beta 文档中甚至没有在可能的订阅类型下列出此资源,是否支持它?
在这一点上,我很确定这个功能不会work/exist。