botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Skype crash on response

Open edejin opened this issue 10 years ago • 5 comments

Source from here https://docs.botframework.com/en-us/node/builder/chat/dialogs/#navtitle

...

// //////////////////////////////////////////////////////////////////////////////////////////////////////////////
var restify = require('restify');
var builder = require('botbuilder');

//=========================================================
// Bot Setup
//=========================================================

// Setup Restify Server
var server = restify.createServer();
server.listen(cnf.port, function() {
  //console.log('%s listening to %s', server.name, server.url);
});

// Create chat bot
var connector = new builder.ChatConnector({
  appId: cnf.appId,
  appPassword: cnf.appSecret
});
var bot = new builder.UniversalBot(connector);
server.post('/v1/chat', connector.listen());

//=========================================================
// Bots Dialogs
//=========================================================

bot.dialog('/', [
  function(session, args, next) {
    if (!session.userData.name) {
      session.beginDialog('/profile');
    } else {
      next();
    }
  },
  function(session, results) {
    session.send('Hello %s!', session.userData.name);
  }
]);

bot.dialog('/profile', [
  function(session) {
    builder.Prompts.text(session, 'Hi! What is your name?');
  },
  function(session, results) {
    session.userData.name = results.response;
    session.endDialog();
  }
]);
Error: Request to 'https://skype.botframework.com/v3/conversations/29%3A1ix2VEyaXBFr8CNKV81fUslCBG7ESOdB39e1N2fzFbZI/activities' failed: [400] Bad Request
    at Request._callback .../node_modules/botbuilder/lib/bots/ChatConnector.js:410:46)
    at Request.self.callback (.../node_modules/botbuilder/node_modules/request/request.js:187:22)
    at emitTwo (events.js:100:13)
    at Request.emit (events.js:185:7)
    at Request.<anonymous> (.../node_modules/botbuilder/node_modules/request/request.js:1044:10)
    at emitOne (events.js:90:13)
    at Request.emit (events.js:182:7)
    at IncomingMessage.<anonymous> (.../node_modules/botbuilder/node_modules/request/request.js:965:12)
    at emitNone (events.js:85:20)
    at IncomingMessage.emit (events.js:179:7)

edejin avatar Aug 10 '16 13:08 edejin

I am having a similar issue. It seems the only way to send a proactive message to a user is using UniversalBot.beginDialog(address, dialogId);

Using send on either connector or bot, passing in a Message (with address and serviceUrl set), will result in the failed: [400] Bad Request. Construction of the Message in my case is without session

Basically the problem is with this approach, from the sample node.js code:

        var reply = new builder.Message()
                .address(message.address)
                .text("Hello %s... Thanks for adding me. Say 'hello' to see some great demos.", name || 'there');
        bot.send(reply);

The address (externally stored) works just fine if I pass it into bot.beginDialog(), but when I construct a Message with it, I am getting the bad request errror

HKOLWD avatar Aug 16 '16 15:08 HKOLWD

Hello @Leoperd87 are you still seeing this issue?

danmarshall avatar Aug 26 '16 22:08 danmarshall

Hello @HKOLWD is your issue related? If not, perhaps you can open a new issue with the scenario you are experiencing.

danmarshall avatar Aug 26 '16 22:08 danmarshall

Looks to be similar @danmarshall

HKOLWD avatar Aug 27 '16 13:08 HKOLWD

@Stevenic or @maxpert can you look at this and comment or close?

chrimc62 avatar Nov 26 '16 23:11 chrimc62