How to get chat id from conversation id

DevAsith 51 Reputation points
2024-08-16T09:23:01.7966667+00:00

I'm currently developing a Teams Chat Bot application and need to access the chat history.

My plan involves obtaining the chat ID and using the Graph API to retrieve the most recent messages.

However, I've only been able to acquire the conversation ID. How can I obtain the chat ID for the message?

User's image

public async Task OnMessageActivityAsync(ITurnContext turnContext, AppState turnState, CancellationToken cancellationToken)
{ 
        string token = turnState.Temp.AuthTokens["graph"];
        var conversationReference = turnContext.Activity.GetConversationReference();
        var teamsChannelId = turnContext.Activity.TeamsGetChannelId();
        var teamsChannelIdws = turnContext.Activity.TeamsGetSelectedChannelId();
 // how to get chat id ???
}
Microsoft Teams | Development
Microsoft Teams | Microsoft Teams for business | Other
{count} votes

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.