Uniqueness Of Conversation ID for Single Bot in MS Teams Channel for Multiple Tenant

Hasit Parmar 5 Reputation points
2024-03-05T07:30:06.8+00:00

We are using botframework-connector SDK for python for implementating bot, in that we would like to retrive user's conversation ID whenever user install teams bot in personal scope or groupchat.

To get conversation id we were listening on_installation_update_add event of botbuilder.core.teams.TeamsActivityHandler and using turn_context.activity.conversation.id to that get conversation id. 1. Does the Connector Id remains Unique Per Bot Per Channel in multi tenant scope we are asking here for Ms Teams specific channel for multiple organization which can use our bot?

  1. In that case we store the conversation Id for proactive messaging which will be across multiple organization within the scope of Ms Teams?
  2. Is there any other approach we might think in order to do proactive messaging our main concern here is the message should not be posted or missed due to lack of conversation id or duplicating conversation id and it should only be posted to the accessible user only
Microsoft Teams | Development
Microsoft Teams | Microsoft Teams for business | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Prasad-MSFT 9,061 Reputation points Microsoft External Staff Moderator
    2024-03-05T11:43:03.4233333+00:00
    1. The Connector Id in Microsoft Teams is unique per bot per channel, even in a multi-tenant scope. This means that each bot installed in a specific channel within a team will have a unique Connector Id. This uniqueness ensures that messages sent by the bot are directed to the correct channel and do not interfere with other bots or channels within the same organization or across multiple organizations.
    2. When storing the conversation Id for proactive messaging across multiple organizations within the scope of Microsoft Teams, it's important to ensure that the conversation Id is associated with the correct user or channel to avoid any message misdirection. By using the correct conversation Id, you can target specific users or channels for proactive messaging without the risk of messages being posted to unintended recipients.

    To implement proactive messaging in Microsoft Teams using the Bot Framework Connector SDK for Python, you can follow these steps:

    • Listen for the on_members_added event to capture the necessary information when a user installs the bot in personal scope or group chat.
    • Retrieve the conversation Id from the turn_context.activity.conversation.id property to store it for proactive messaging.
    • Use the stored conversation Id along with other required information (such as aadObjectId, userId, tenantId, and serviceUrl) to create the conversation for proactive messaging.
    • Ensure that the proactive messages are targeted correctly by verifying user accessibility and channel availability using the Microsoft Graph API if needed.

    Thanks, 

    Prasad Das

    ************************************************************************* 

    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.


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.