botframeworkdirect-line-botframework

Connecting two bots with DirectLine javascript


this is my scenario:

I need to set Bot A as a proxy receiving the audio attatchments and asking to Bot B showing the returning answer inside Bot A.

I've already managed to connect those two bots with directline and my problem comes after the conversation is started: in Bot A i'm using the REST API for send messages and websocket to receive the activities using the streamURL.

After i create the websocket i call for on message event to get the messages comming from the Bot B but i need to show them using await context.sendActivity(MessageFactory.text...

            [...]
            response = await axios.post(url, null, config);
            ws = new WebSocket(response.data.streamUrl);

            ws.on('message', function incoming(data) {
              [...]
            }

Thanks in advance.


Solution

  • Please look over the 80.skills-simple-bot-to-bot sample for guidance on how to connect two bots. The sample demonstrates a "root bot" (your Bot A) calling the "skill bot" (your Bot B) and executing a dialog before returning control back to the root bot. The conversation Id is maintained across the root and skill bot by use of the SkillConversationIdFactory.

    Reference the Implement a skill docs for additional information on setting up and consuming a skill.