How to send message later in bot framework?

前端 未结 2 1771
名媛妹妹
名媛妹妹 2020-12-21 20:57

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 mes

2条回答
  •  执笔经年
    2020-12-21 21:53

    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);
    

提交回复
热议问题