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
