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"); });
source share