botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Is there any way to setup a message to be sent every X minutes/hours?

Open etriebe opened this issue 10 years ago • 7 comments

I'd like for people to be able to setup a schedule for a message type. e.g. "Send me $STOCK stock price every X minutes" and then the bot creates a thread that spawns that often with the right context data to run correctly. I'm even happy to store the schedule information in an Azure Table, I'm just trying to figure out the best way to get the bot framework to let me spawn threads and then call into the messages controller.

etriebe avatar Jul 27 '16 23:07 etriebe

+1

rlilov avatar Jul 28 '16 07:07 rlilov

+1

rzmoz avatar Jul 28 '16 07:07 rzmoz

So, are you saying I can post a message to a conversation which is originating from custom code?

So for example: User: Hi, remind me every day at 12 PM bot creates Azure scheduler Bot replies: Timer created Azure scheduler calls a custom endpoint User receives message: It is now 12 PM

How would the address look like that you're sending the message to? Are you pinging the bot endpoint directly or are you going through the bot-framework canvas?

rzmoz avatar Jul 28 '16 09:07 rzmoz

but does it work now already also, that you can iniate a Skype Group message from botbuilder SDK?

liiver avatar Jul 28 '16 09:07 liiver

What exactly do you mean by address? Do you mean that the bot should aske the user for a custom web hook which circumvents the bot canvas? So you're saying that this scenario is not directly supported by the bot framework?

Or are you saying that a bot can resume a conversation even after being idle for a while? Again, I'm not sure what you mean by address.

rzmoz avatar Jul 29 '16 02:07 rzmoz

Thank you for your help on this, Alexey.

I am using C# but I found the following: https://docs.botframework.com/en-us/restapi/connector/#navtitle

The old direct line had a unique conversation ID so it wasn't possible to post messages to a slack conversation for example. Seems the new V3 API doesn't have that restriction though I have to verify it.

Also, the SDK seems to be calling these methods directly but I haven't looked at the low level calls yet.

So in short, it seems the scenario is possible though you would probably have to keep the conversation alive from the scheduler side. I would assume a conversation will expire if there's no activity for a while.

rzmoz avatar Jul 29 '16 06:07 rzmoz

If your bot wants to send a proactive message, you can keep the ServiceUrl and the user’s ChannelAccount (extracted from one of the messages from that user) and use this data to send a new activity from your bot to that user using:

SendToConversationAsync(…), CreateConversationAsync(…), or CreateDirectConversation(…)

LarsLiden avatar Jul 29 '16 20:07 LarsLiden