Search code examples
c#triggersbotframeworkeventtrigger

Trigger MS Bot to proactively send msg to registered user


I have set up a microsoft bot to capture information on the users that add it to the contacts. I was able to start a new conversation when the skype user initiates conversation.

I do so with a trigger in the RootDialog.cs:

t = new Timer(new TimerCallback(timerEvent));
t.Change(5000, Timeout.Infinite);

this will initiate a new conversation after 5 ms.

Although this works, This is not what I want to achieve.

Besides the Bot API Controller I have another controller running in my program.

This api which does not use the [BothAuthentication] tag receives http post request from other systems.

These posts contain information that I then need to send to the user in skype.

Although, I am not able to pass information from one ApiController, that has nothing to do with a Bot Connector, to the Bot Controller which can actually send messages to a user.

What kind of a trigger can I use to fire the action in the bot controller to send the msg to the user I preconfigured? Can I have a list of request coming in from other systems and listen for events on the bot controller? if so how? I checked ObservableCollection but always associated with some Interface binding.

Or can I pass information from one controller to another?

Really appreciate the help.


Solution

  • You have to use Conversations.SendToConversationAsync. Check this.