Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
413 views
in Technique[技术] by (71.8m points)

scheduled tasks - How to send message later in bot framework?

I want my bot to be able to send some replies later. Like in alarm clock, when user says, ping me at 5 AM then I want to send message to the user at 5 AM. How can I send message without receiving one?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You'll need to receive at least one message so that you know the recipient's address. You'll need to save the addressing info from the incoming message. I think the easiest way is to save the whole message.

Nodejs:

var reply = session.message; // address: reply.address
// ...
reply.text = 'Wake up!';
bot.send(reply);

C#:

var reply = activity.CreateReply(""); // reply.Recipient, reply.Conversation, etc.
// ...
reply.Text = "Wake up!";
ConnectorClient connector = new ConnectorClient(new Uri(reply.ServiceUrl));
await connector.Conversations.ReplyToActivityAsync(reply);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...