1

I have tried developing azure bots before. Currently I am trying to find out whether there is any way we could set up a bot that can constantly monitor something and send messages to particular users without user initiating a chat.

For instance, a bot monitors a system and find something wrong and sends a chat message to the user ( Bot initiates the chat in this case ). I did some research but couldn't find any way to achieve this yet.

Thanks in advance,

DM

D. Manjali
  • 19
  • 1

1 Answers1

1

This concept is called Proactive Messaging in the Bot Framework. There are some example in C# here: https://github.com/Microsoft/BotBuilder-Samples/tree/master/CSharp/core-proactiveMessages and node.js here: https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-proactiveMessages

Something to note is that different channels have different restrictions on when a proactive message can be sent to a user. For instance, on Facebook you have a 24 hour window from the time the user messaged the bot. After 24 hours, if the user has not messaged the bot, then proactive messages will not be allowed through.

More information can be found in this doc: https://learn.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-proactive-messages

Edit:

You can also create a Functions Bot in Azure using the Proactive template and it will create a bot that has BasicProactiveEchoDialog.csx that demonstrates how to en-queue a CloudQueueMessage into a CloudStorageAccount. The template will also create an Azure Function that is triggered by additions to the queue. When the function is triggered, it will send the queued message to the user on the channel.

Eric Dahlvang
  • 8,252
  • 4
  • 29
  • 50
  • Thanks a lot Eric. My scenarios is slightly different. My bot should be able to monitor something constantly and notify user only if required. For instance, something wrong in a system and then a send a message to user via channels like skype. So bot initiates a chat only when its required. I did some research and it looks like it might be possible from Azure function to initiate a chat bot. But I still couldn't find a good c# sample / make it working. To start with I am trying a time trigger from Azure function - ie: call my bot at certain intervals of time. Couldn't make it work yet. – D. Manjali Jan 20 '18 at 10:59
  • @D.Manjali I've updated my answer with some information about the Proactive template in Azure. – Eric Dahlvang Jan 24 '18 at 05:53
  • Thanks a lot Eric. Appreciate your support. I will try these. – D. Manjali Jan 25 '18 at 11:08