Bot framework sends proactive message to user address

I am using Microsoft Bot Framework, Webchat Channel, NodeJS

Also using Bot-Trees to manage my conversations.

How can I send proactive messages to the user? I save the user address in my database, which includes the user ID, bot ID, conversation ID, etc.

I tried this solution by sending the last user address that I saved, the request went well without errors, but the message didn’t arrive at the client (webchat).

Any suggestions?

thanks

Proactive communication route, project of bot trees:

var connector = new builder.ChatConnector({ appId: client.id, appPassword: client.password, }); var bot = new builder.UniversalBot(connector); app.post(`/proactiveTest`, (req, res, next) => { if (!req.query.addressId ||!req.query.userId || !req.query.convId || !req.query.botId){ res.send("Missing params") } let channelId = 'webchat'; let id = req.query.addressId; var user = {id : req.query.userId, name : req.query.userName}; let conversation = {id : req.query.convId}; let botDetails = {id : req.query.botId , name : req.query.botName}; let serviceUrl = "https://directline.botframework.com/"; let address = {id, channelId, user, conversation, botDetails, serviceUrl}; var msg = new builder.Message().address(address); msg.text("This is a test"); msg.textLocale('en-US'); bot.send(msg); res.send("Message sent"); }); 
+5
source share
2 answers

Try changing this line:

 let address = {id, channelId, user, conversation, botDetails, serviceUrl}; 

For this:

 let address = {id, channelId, user, conversation, bot: botDetails, serviceUrl}; 

In addition, you configure the channel for web chat, but using https://directline.botframework.com/ for the service URL.

+1
source

please go to your bot service and find the β€œChannels” tab. There you will see your open chat channels, check the "Problems" link close to the web chat line.

-1
source

Source: https://habr.com/ru/post/1275305/


All Articles