1
votes

I'm going over the Microsoft Teams section of the Graph API and trying to find out how to do two things:

  1. Create a new chat, giving it a topic that correlates to an entity in our app (essentially creating a chat around an entity), invite specific users into it, and send messages to the chat.

  2. Access the currently logged-in user's private chats, filtered by their topic, and show their contents inside our app.

For #2, it looks like it should be possible using beta endpoint of the Graph API, but I get 403 Forbidden errors both in the Graph Explorer when trying to access https://graph.microsoft.com/beta/me/chats, and in my own app, after enabling the Chat.Read permissons for it.

For #1, it looks like the API doesn't officially support creating new chats at all.

Is there any approach we can use to create and manage chats? Is there an alternative, perhaps not MicrosoftGraph-based API?

2

2 Answers

1
votes

as you mention, the ms graph doesn't yet support initiating group chat. You would use the MS Bot Framework for this: https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/bots/bot-conversations/bots-conv-proactive

I see the docs on these Chat api do exist, but they are not present in the Graph Explorer. I tired testing them in the OfficeApiEditor tool with a v2.0 App Registration and Delegated permissions (Chat.Read) and i get this:

Failure - Status Code 500
"code": "InternalServerError",
"message": "Error while processing response.",

so maybe it will take some time before they are really available in beta.

1
votes

In MS teams, there is a api called ChatMessage to post a message to a chat(only if the chat already exist or started). But, there is no api to create/start a new chat. I have raised a feature request. Do vote for this to suggest this idea to Microsoft. https://microsoftteams.uservoice.com/forums/913786-microsoft-teams-free/suggestions/38776681-it-would-be-awesome-l-if-there-is-an-api-functiona