How can we trigger an event from MS Teams (call an external app) on send chat message or reply a message?

Sahi Repswal 161 Reputation points
2023-01-16T09:03:04.1233333+00:00

When any user send chat message or reply any message we want to propagate this information to our custom application and perform some actions. Is there any way to trigger this event ?

Microsoft Teams | Development
Microsoft Security | Microsoft Graph
Microsoft Teams | Microsoft Teams for business | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. HarmeetSingh7172 4,826 Reputation points
    2023-01-16T16:09:01.97+00:00

    Hello @Sahi Repswal

    Thanks for reaching out!

    You can use Change notifications to achieve this use-case. Change Notifications enable you to subscribe to changes (create, update, and delete) to messages in a channel or chat. Whenever, there will be new message in a Teams Channel or chat, notification will be triggered for that and based on the API response, you can automate your process further. Please follow this detailed documentation to know how change notifications works for MS teams resources.

    Please note that "The maximum time a Teams subscription can last is 60 minutes; however, subscriptions can be renewed until the caller has permissions to access the resource".

    Please do refer these:

    [https://github.com/microsoftgraph/microsoft-graph-docs/blob/main/concepts/teams-changenotifications-chatmessage.md

    [https://learn.microsoft.com/en-us/graph/webhooks?tabs=http


    Hope this helps.

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


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.