Broadcast messages to a specific message to all the users connected to the Bot

lakshmi 551 Reputation points
2024-02-29T17:41:55.5733333+00:00

I am working on a bot framework project that uses team channel for connecting to the bot. We are supporting the IT department and we want to broadcast the System down message or other specific messages to all the users who are using this Bot. Can you suggest the best method to broadcast the same message to the list of users stored in the db. Can we use azure function trigger for this ? which can be the best trigger?

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
747 questions
{count} votes

1 answer

Sort by: Most helpful
  1. navba-MSFT 17,115 Reputation points Microsoft Employee
    2024-03-01T04:28:49.34+00:00

    @lakshmi Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    Here’s a high-level approach:

    • Store User Information: When a user interacts with the bot, store their information (UserId, UserName, ServiceURL) in a database.
    • Create Azure Function: Create an Azure Function that is triggered based on your requirements. This could be a timer trigger if you want to send messages at specific times, or an HTTP trigger if you want to manually trigger the broadcast.
    • Broadcast Messages: In your Azure Function, retrieve the list of users from the database. For each user, create a conversation using the stored ServiceURL and UserId. Then, send the message to the conversation.

    This StackOverflow post talks about the sample approach:

    https://stackoverflow.com/questions/42247819/microsoft-bot-framework-broadcast-messages-to-users-from-database

    Alternatively, To broadcast a message to all the users who are using your bot, you can use the SignalR output binding to send messages to clients connected to Azure SignalR Service. You can broadcast messages to all clients, or you can send them to a subset of clients. For example, only send messages to clients authenticated with a specific user ID, or only to a specific group. The trigger details and broadcast function sample is here:

    https://learn.microsoft.com/en-us/azure/azure-signalr/signalr-concept-serverless-development-config#sending-messages-and-managing-group-membership

    Hope this helps.

    0 comments No comments