Wednesday, 12 April 2017

how to send message using bot builder in node js for cross platform

By using the code below I am able to send the message if the channelId attribute of "To" and "From" fields is same. Here is the code-

var msg = new builder.Message().address({
            id: session.message.address.id,
            serviceUrl: saveAddress,
            useAuth: true,
            isGroup: true,
            to: {

                id: "29:1cJLt2rNGzi9QUJqYSVRBbPQLyhuS8qKaUJJ2WikGwp8",
                name: "user name",
                channelId: "skype",
                isBot: false
            },
            conversation: {
                id: "29:1cJLt2rNGzi9QUJqYSVRBbPQLyhuS8qKaUJJ2WikGwp8"
            },
            from: {
                id: "botId",
                name: "myBot name",
                isBot: true,
                channelId: "skype"
            }
        }).text("Here is question from user :- " + userQuestion);
        session.send(msg);

But when I change the "To" channelId: "facebook" then I receive the error below:

Error: Request to 'https://facebook.botframework.com/v3/conversations/29%3A1cJLt2rNGzi9QUJqYSVRBbPQLyhuS8qKaUJJ2WikGwp8/activities/Be2TENy8BNm' failed: [400] Bad Request

So, how can I fix this issue? Any help and suggestions are appreciated.



via surabhi kandi

No comments:

Post a Comment