Microsoft Teams webhook subscription doesn't work

Fabio Fornaciari 26 Reputation points
2023-11-10T15:10:56.5233333+00:00

Hello,

I'm using the graph api with my delegated user,
and it worked well, but from some days, they are stopped.
So, currently I'm able to generate a subscription:
POST
https://graph.microsoft.com/v1.0/subscriptions
Body:

{
  "changeType": "created,deleted,updated",
  "notificationUrl": "<my_endpoint_resource>",
  "resource": "/chats/<chatId>/messages",
  "includeResourceData": false,
  "expirationDateTime": "YYYY-MM-DDThh:mm:ss.0000000Z"
}

I am able to receive and answer well to the validation process, and I got the response to the previopus POST cal of subscribe resource:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#subscriptions/$entity",
    "id": "<subId>",
    "resource": "/chats/<chatId>/messages",
    "applicationId": "<appId>",
    "changeType": "created,updated,deleted",
    "clientState": null,
    "notificationUrl": "<my_endpoint_resource>",
    "notificationQueryOptions": null,
    "lifecycleNotificationUrl": null,
    "expirationDateTime": "2023-11-10T15:38:00Z",
    "creatorId": "<creatorId>",
    "includeResourceData": false,
    "latestSupportedTlsVersion": "v1_2",
    "encryptionCertificate": null,
    "encryptionCertificateId": null,
    "notificationUrlAppId": null
}

I had verified that the subscriptionId is correctly present calling
GET https://graph.microsoft.com/v1.0/subscriptions/<subId>

and it exists! But when i write or receive messages on that chat, I don't receive any call to my resource.

Edit:

I had changed the resource registered from
"/chats/<chatId>/messages"
to
"/users/<userId>/chats/getAllMessages"

It started to work well, but after some days, without any changes it stopped again.
The subscription is correctly up and running, but no notifications comes from chats

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
8,161 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,174 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,545 questions
0 comments No comments
{count} vote