Send OneOnOne Teams Chat message through Graph API from .NET Core WebAPI without user signed in

Chakravarthi Tamatam 1 Reputation point
2021-02-25T05:03:50.757+00:00

I have a requirement to send a chat message with parameters (email and message content) using Graph API from my .Net Core Web API.
Without any signed in user I have to send the chat message. Is it possible with Graph API? If not, is there any alternatives?

It is working in Graph explorer but getting Unauthorized or Unknown Error.

Please help me on this.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,307 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,124 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,521 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Wang-MSFT 1,061 Reputation points
    2021-02-26T08:26:34.497+00:00

    Hi, @Chakravarthi Tamatam ,
    From official document, Microsoft Graph must send chatMessage in a channel or a chat. And I think SignalR is a better choice for the boardcast requirement.

    The SignalR Hubs API enables you to call methods on connected clients from the server. In the server code, you define methods that are called by client. In the client code, you define methods that are called from the server. SignalR takes care of everything behind the scenes that makes real-time client-to-server and server-to-client communications possible.

     Clients.All.broadcastMessage(name, message);  
    

    ------
    If the answer doesn’t solve your issue, please provide more details of error that will help us track down what’s happening.
    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,
    Michael Wang