node.jsazurebotframeworkskype-bots

Bot Framework Node.js ad hoc message TO A SPECIFIC USER


I have been staring at this for hours and can't find a solution and that is even though by all suggestions it SHOULD be quite easy - https://learn.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-proactive-messages.

I have created a simple code which will "register" the user and save their data in my cosmosDatabse on Azure. That works perfectly.

//ON "register" SAVE USER DATA AND SAY REGISTERED MESSAGE 
bot.dialog('adhocDialog', function(session, args) {

    var savedAddress = session.message.address;
    session.userData.savedAddress = savedAddress;
    //REGISTERED MESSAGE
    session.endDialog("*Congratulations! You are now registered in our network! (goldmedal)*");
})
.triggerAction({
    matches: /^register$/i
})

I am fairly certain we have to write the conversation ID or user ID somewhere. The question is where?

function startProactiveDialog(address) {
    bot.beginDialog(address, "A notification!");
}

Solution

  • I created a users.json file, to which I save all the users. It works the way I need it to. I guess database would be better, but I don't really have a clue where to begin with that. Database is a whole new chapter I have not encountered yet, so it doesn't make sense to work on it when the project needs are resolved.