Botframework-sdk: Push bot automaticaly to user

Created on 28 Oct 2016  路  20Comments  路  Source: microsoft/botframework-sdk

Is there any way to push the bot to message the user o a particular time of the day?

so that bot sends hi to the user. or any internal clock?

help wanted

All 20 comments

Yes, you can use createDialog method

Where should i use that?! and how to schedule bot to do it?

This is method of botbuilder instance. You could use It any where. For scheduling you could use some of external npm modules. I can provide example of call when I will be at home :)

for example

bot.beginDialog({
channelId: 'skype',
user: {
id:
},
bot: {
id:
},
conversation: {
id:
},
serviceUrl: 'https://skype.botframework.com',
useAuth: true
}, '/notify/new_build', data);

Thats cool. Am working with c# , know the code in that?

No. But as I know it will be simmular to nodejs sdk.

Yea!. am waiting for someone to answer the method to schedule in c# sdk

@alokraj68 is this what you're looking for? (http://stackoverflow.com/questions/38431234/how-to-schedule-tasks-in-microsoft-bot-framework-c/)

Let me see if that works @kienct89

@cejixo3 what if the conversation has already finished? (ex. the token is no longer valid).

In nodejs for dialog initiation we need only transport, skype Id, and service url. We do not keep any tokens by hand. But I think you told about session token between not and skype services, right?

I have not yet used a token in C#. my bot is currently working well, but I got no idea how to make this auto push to a user on a predefined time if he is subscribed to notifications.

Hi,
I use an external windows service to push updates to my subscribed users.

You need to initialize a new IMessageActivity like:

``` c#
Activity.CreateMessageActivity();

and then fill these fields:
- From
- Recipient
- Conversation
- Text (or what you need)

To check the unsubscribed users I parse the response after sent the push:

``` c#
var res = await connector.Conversations.SendToConversationAsync((Activity)message);

If I had an error I remove the user from my push list.

If you use the Facebook Messenger channel you could also specify the push notification type to _REGULAR_ so the user will receive the notification to his smartphone notification hub too.

c# message.ChannelData = JObject.FromObject(new { notification_type = "REGULAR" });

Hi @valse ,
I have been trying to use hangfire for the purpose, but could not configure it until now.
can you help me out?

http://stackoverflow.com/questions/38431234/how-to-schedule-tasks-in-microsoft-bot-framework-c/38435130?noredirect=1#comment68043314_38435130

Which tool are you using?

I'm using Quartz.NET for scheduling a process that retrieve info from a sql server db and do the job... but I think that use hangfire is a better choice 馃槈

@valse why do you think so? am having trouble with hangfire as my MySQL server is not in azure.

@valse quartz works with mysql? Hangfire does not. Am looking for somthing with mysql support.

Closing due to age, change of topic and lack of activity. Please reopen if you still have a bot framework issue.

Can someone provide a working code on how to use azure cron job or any other service for the same in c#

@chrimc62 Please provides help before closing this.

Was this page helpful?
0 / 5 - 0 ratings