Error : The bot is not part of the conversation roster. while sending message in channel through bot

Devesh Tiwari 180 Reputation points
2024-11-19T10:12:48.9966667+00:00

We have a bot that can be installed in a Team as well as in personal scope. We are facing issue when bot is trying to send message in the channel where it is installed. It was working fine few days back but all of a sudden, it's throwing error:  

{"error":{"code":"BotNotInConversationRoster","message":"The bot is > not part of the conversation roster."}}  >     Details :  >     teamId :19:3684c109f05f44efb4fb54a988d70286@thread.tacv2 >     Error: Operation returned an invalid status code 'Forbidden' >     StackTrace: at Microsoft.Bot.Connector.Conversations.CreateConversationWithHttpMessagesAsync(ConversationParameters > parameters, Dictionary`2 customHeaders, CancellationToken > cancellationToken) at > Microsoft.Bot.Connector.ConversationsExtensions.CreateConversationAsync(IConversations > operations, ConversationParameters parameters, CancellationToken > cancellationToken)

Below is my code:

    var channelData = new TeamsChannelData                     > {                        > Channel = new ChannelInfo(cId),                         > Team = new TeamInfo(cId),                         > Tenant = new TenantInfo(tenantId)                     > };                     > var conversationParameters = new ConversationParameters                    > {                         > IsGroup = true,                         > Bot = null,                         > ChannelData = channelData,                         > Members = null,                         > Activity = activity,                   >   };                     > await connectorClient.Conversations.CreateConversationAsync(conversationParameters);

  The bot is able to send direct message to users

Note: - I can confirm that the bot is part on the team, and it is installed within the team. Bot is able to send one-to-one message to the user. We are facing issues only when trying to send message in a channel.

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,388 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.
3,369 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Kilian 345 Reputation points
    2024-11-19T10:14:07.23+00:00
    1. Reinstall the Bot: Remove and re-add the bot to the team.
    2. Verify Installation: Ensure the bot is correctly installed and receiving installationUpdate events.
    3. Use Graph API: Add the bot to the channel using Microsoft Graph API.
    4. Check Permissions: Ensure the bot has the necessary permissions in Azure AD.
    5. Update SDK: Use the latest Bot Framework SDK.
    1 person found this answer helpful.

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.