Microsoft Teams webhook subscription doesn't work

Fabio Fornaciari 31 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.
10,431 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,453 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.
3,390 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. AsithwMSFT 1,430 Reputation points Microsoft Vendor
    2023-12-10T22:12:38.0133333+00:00

    @Fabio Fornaciari

    your subscription might be already expired.

    check subscription lifetime

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.