3

I'm trying to create a subscription to receive notifications about user messages, but I'm receiving an ExtensionError. I'm basing myself on Team chats

I've tried to create a subscription with the sample code I've found on Microsoft but I received an error. My expectation is to create a subscription to capture all chat messages on Teams.

Permissions Granted: Permissions

My body:

{
    "changeType": "created",
    "notificationUrl": "https://teams.execute-api.us-east-1.amazonaws.com/dev/notification-listener",
    "lifecycleNotificationUrl": "https://teams.execute-api.us-east-1.amazonaws.com/dev/lifecycle-notification-listener",
    "resource": "/me/chats",
    "expirationDateTime": "2024-12-05T22:00:00Z",
    "clientState": "secretClientState",
    "latestSupportedTlsVersion": "v1_2"
}

The error I'm receiving:

Internal Server Error - 500 - 5157 ms

{
    "error": {
        "code": "ExtensionError",
        "message": "Operation: Create; Exception: [Specified method is not supported.]",
        "innerError": {
            "date": "2024-12-02T18:44:12",
            "request-id": "7f6ebfd6-dad6-41ec-8c88-1c48478f230d",
            "client-request-id": "a3497e47-55a0-dae8-1bc6-0500c1dc4df1"
        }
    }
}

Request

My Lambda

4
  • Could you edit your question and add your complete API request along with what permissions you granted? Commented Dec 5, 2024 at 3:35
  • Seems like the resource /me/chats is not correct. It should be either /users/{id}/chats/getAllMessages or /me/chats/getAllMessages Commented Dec 5, 2024 at 8:13
  • Hey @Sridevi, I've updated the post with additional information. Commented Dec 5, 2024 at 12:52
  • @user2250152 I tried with both but it didn't work :/ Commented Dec 5, 2024 at 12:52

2 Answers 2

3

Initially, I created one Partner configuration for Sri resource group by authorizing Microsoft Graph API to create resources like this:

enter image description here

In my case, I ran below API request in Graph Explorer to create subscription for capturing all chat messages of user on Teams:

POST https://graph.microsoft.com/v1.0/subscriptions

{
    "changeType": "created",
    "notificationUrl": "EventGrid:?azuresubscriptionid=subId&resourcegroup=rgname&partnertopic=TeamsTopic&location=eastus",
    "lifecycleNotificationUrl": "EventGrid:?azuresubscriptionid=subId&resourcegroup=rgname&partnertopic=TeamsTopic&location=eastus",
    "resource": "/me/chats",
    "expirationDateTime": "2024-12-02T22:00:00Z",
    "clientState": "secretClientState",
    "latestSupportedTlsVersion": "v1_2"
}

Response:

enter image description here

Make sure to grant consent to Chat.Read permission for signed-in user in Graph Explorer before running the Graph API query:

enter image description here

To confirm that, I checked the same in Portal where Partner Topic created successfully as below:

enter image description here

Sign up to request clarification or add additional context in comments.

9 Comments

Can I create a subscription only using Event Grid? I tried using lambda urls but i've same error :/
You can also use webhook URL, refer this learn.microsoft.com/en-us/graph/…
I'm trying to use lambdas, do i need to register the links on Azure?
Yes, try following this MS Doc and do with event grid once learn.microsoft.com/en-ca/azure/event-grid/… Select Microsoft Graph in Partner Authorization.
Of course, Thank you!!
|
1

To make the subscription, your account must be a tenant other than 'Personal'.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.