Integrate microsoft teams to post messages in channel

Goel 1 Reputation point
2021-09-08T13:04:34.757+00:00

Hello

We are having an application developed using angular where companies can register and can invite other users as well. Now what we want is that if company admin connects with teams from application then other users including admin can post messages in channel means whenever any user post a message then that message should be posted on teams channel as well but other users won't have to connect using teams. Every user will have separate account in application. Is it possible ?

Thanks
Honey Goel

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,282 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,776 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nivedipa-MSFT 2,806 Reputation points Microsoft Vendor
    2023-07-27T07:13:23.7933333+00:00

    @Goel -
    Yes, it is possible to achieve the integration you described between your Angular application and Microsoft Teams. You have to build custom Teams app that allows the company admin to connect their account with Teams, and then other users, including the admin, can post messages to a Teams channel without having to individually connect their accounts.

    1. You need to build a custom Teams app in the Microsoft Teams developer portal. This app will allow you to interact with Teams and post messages to channels.
    2. Set up authentication for your Angular application, allowing company admins to connect their accounts with Teams. You can use OAuth 2.0 to authenticate the admin's account with Microsoft Teams.
    3. Once the company admin connects their account with Teams, your application should obtain an access token for the admin's account. This token will be used to authenticate API requests made from your application to Teams on behalf of the admin.
    4. With the access token, your Angular application can use the Microsoft Teams Graph API to post messages to the desired channel within Teams. The API allows you to send messages, notifications, and more to a channel.

    Graph API to post message in channel.
    POST /teams/{team-id}/channels/{channel-id}/messages
    Ref Doc: https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http

    Thanks,

    Nivedipa


    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.

    1 person found this answer helpful.
    0 comments No comments