0

I have successfully hosted an instance of microsoft's Botframework web chat using directline on public domain, I want to make a chatbot in such a way that my customers can have their own channels completely separated from each other and I cannot find any kind of documentation anywhere, Kindly suggest me if this is possible and how?

I have written the complete code in Node.js and have very less idea about c#.

Dexter
  • 236
  • 2
  • 12

1 Answers1

1

It seems that there is no such feature for uniform customized chat channel in bot framework. So we can leverage new builder.Message().address(address) to send messages to specific users from the official sample at https://github.com/Microsoft/BotBuilder-Samples/blob/master/Node/core-proactiveMessages/simpleSendMessage/index.js.

So I had a quick test which will save the users' addresses into an address list in server memory as a "customize channel", and trigger a key work to send message to these addresses in list as a broadcast in this "customize channel":

let channel_address = [];
bot.dialog('joinChannel',(session)=>{
    channel_address.push(session.message.address);
}).triggerAction({
    matches:/join/i
})

bot.dialog('broadcast',(session)=>{
    channel_address.forEach((address)=>{
        bot.send(
            new builder.Message(session).address(address).text(session.message.text)
        )
    })
}).triggerAction({
    matches:/^broadcast: .*/
})

Test Step:

  • Open two emulators connect to your local bot
  • in both emulators, type "join"
  • in either emulator, type text like broadcast: hi there enter image description here
Gary Liu
  • 13,758
  • 1
  • 17
  • 32