Share via

Microsoft Teams Bot Framework – Proactive messaging limitations and Graph API queries for channels/tag

Deborthia Azbill 120 Reputation points
2025-09-05T13:48:55.39+00:00

I'm building a Microsoft Teams bot using the Bot Framework and Microsoft Graph API. I need to proactively message a user who hasn't interacted with the bot yet. Currently, I only have their Entra ID (Azure AD object ID), not their Teams user ID or conversation reference.

First, I need the bot to proactively message a user who has not interacted with it yet. I only have the user’s Entra ID (Azure AD object ID), but no Teams user ID or conversation reference. Is there a way to initiate a proactive message using just the Entra ID, or must the user first message the bot so that a conversation reference can be stored?

Second, I need to retrieve all channels and tags from a specific Team, including channel IDs, tag IDs, tag names, and associated members. I already have the Team ID. What are the correct Microsoft Graph API endpoints for this, and what permissions are required?

Thanks in advance for any guidance or examples!

Microsoft 365 and Office | Development | Microsoft 365 Developer Program
0 comments No comments

Answer accepted by question author

  1. Steven-N 25,225 Reputation points Microsoft External Staff Moderator
    2025-09-05T14:47:58.91+00:00

    Hi Deborthia Azbill

    Thanks for reaching out to Microsoft Q&A forum support

    Based on your description, I understand that you're building a Microsoft Teams bot using the Bot Framework and Microsoft Graph API. You have two main concerns:

    1. You want to proactively message a user who has not yet interacted with the bot, and you currently only have their Entra ID, not their Teams user ID or conversation reference.
    2. You need to retrieve all channels and tags from a specific Team using the Team ID, including channel IDs, tag IDs, tag names, and associated members.

    Regarding to your first question, as far as I know, proactive messaging in Microsoft Teams bots requires a valid conversation reference, which is typically obtained when a user first interacts with the bot. If the user has not interacted yet, you cannot directly send a message using only the Entra ID.

    However, Microsoft Graph API provides a workaround: you can proactively install the bot for the user and then initiate a conversation, you can try this API method to see if the issue can be resolved:

    POST /users/{user-id}/teamwork/installedApps
    

    Required permissions: TeamsAppInstallation.ReadWriteSelfForUser.All (Application permission)

    Create a conversation: After installation, use the Bot Framework to create a conversation and send a proactive message. This typically involves capturing the conversation reference via a conversationUpdate event or using POST /v3/conversations.

    Link references:

    Regarding to your second question, if you want to retrieve channels and tags from a specific Team using its Team ID, you can use the following Microsoft Graph API endpoints:

    For channel:

    #List all channel
    GET /teams/{team-id}/channels
    
    #Get a specific channel
    GET /teams/{team-id}/channels/{channel-id}
    
    #Get the primary channel
    GET /teams/{team-id}/primaryChannel
    

    For tag:

    #List all tags
    GET /teams/{team-id}/tags
    
    #Get members of a tag
    GET /teams/{team-id}/tags/{tag-id}/members
    

    Required permissions:

    • For channels:
      • Delegated: Channel.ReadBasic.All
        • Application: ChannelSettings.Read.Group, ChannelSettings.ReadWrite.Group
    • For tags:
    • Delegated: TeamworkTag.Read.All
      • Application: TeamworkTag.ReadWrite.All

    Reference documentation:

    However, I think that you should consider implementing a proactive installation flow where your bot installs itself for users based on their Entra ID and then initiates a conversation. This ensures you can reach users even if they haven’t interacted with the bot yet.

    For retrieving channels and tags, ensure your app has the correct permissions and that consent is granted for application-level access if needed. You may also want to cache channel and tag metadata for performance optimization if your bot frequently accesses this data.

    Hope my answer will help you


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".     

    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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.