Sending messages in Teams from a background service

Alexey R Abdulin 10 Reputation points
2023-09-28T11:03:58.6666667+00:00

Hi everyone!

I'm new to MS Graph and Teams, and I'm trying to create a background application that would send a reply to a specific post in a specific channel in MS Teams (or send a message to a specific group chat) based on events.

I set app the application in Azure, obtained a token, got consent for API calls, and was able to use it to create a chat without a problem. However, when I try using this endpoint or that one I receive an error: "Message POST is allowed in application-only context only for import purposes". Reading through the documentation, it appears that we can't use this API call at all without a special migration mode which can't be enabled for every message.

On the other hand, API docs suggest there is a "Delegated access" type, however, it looks inapplicable to a standalone background service which is supposed to be running without any user interactions.

Overall, I'm completely blocked here by Graph API restrictions, and looks like the only way Microsoft is pushing us is to create posts in channels but not messages of any type.

Does someone have a success story? How do you implement notifications in teams?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,506 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ahmed Wael 0 Reputation points
    2024-05-27T12:08:10.1866667+00:00

    Same issue here

    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.