Botframework-sdk: Multiple session.send()

Created on 17 May 2016  路  17Comments  路  Source: microsoft/botframework-sdk

I know this is a duplicate(#107 #259), but I want to bubble it up.

@Stevenic, I am still experiencing issues with multiple session.send() even better... I'm trying to send a message, then start a dialog...

  function (session) {
    session.send("Let's begin");
    session.beginDialog('/begin');
  }

Does not work with _Emulator_ or _Facebook_, so I assume does not work for BotFramework altogether.

The second message just gets swallowed.

bug

All 17 comments

How does '/begin' dialog look like?

bot.add('/begin', [
  function (session) {
    builder.Prompts.choice(session, "What would you like to do?", ['Start Trivia', 'See Help']);
  },
  function (session, results) {
    // handle results
}]);

Are you running v0.10.2?

Yes

https://www.dropbox.com/s/sthdzrb2e5ucpld/Screenshot%202016-05-17%2021.44.49.png?dl=0

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

// Create bot and add dialogs
var bot = new builder.BotConnectorBot({ appId: 'YourAppId', appSecret: 'YourAppSecret' });
bot.add('/', function (session) {
   session.send('Hello World');
   session.send('Hello World2');
});

// Setup Restify Server
var server = restify.createServer();
server.post('/api/messages', bot.verifyBotFramework(), bot.listen());
server.listen(process.env.port || 3000, function () {
   console.log('%s listening to %s', server.name, server.url);
});
{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "botbuilder": "^0.10.2",
    "restify": "^4.0.4"
  }
}

This definitely works... That code wouldn't work when deployed for facebook because your app ID & Secret are wrong but should work with the latest build of the emulator. Are you on a mac or pc?

You're not running the bot in a VM are you?

The emulate runs a webserver so if it's not working its because the bot can't see the emulators server. It assumes it's running on localhost:9000

Steve, I'm running on VM, I do have explicit endpoint specified to my VM, I'm the one created a #282.

I am running latest copy of _Emulator_. The example above is for testing purpose only, I do realize it will not work with live FB.

var bot = new builder.BotConnectorBot({
  appId: settings.botConnector.appId,
  appSecret: settings.botConnector.appSecret,
  endpoint: 'http://192.168.0.108:9000'
});

linking #286

I'll assign to Tom as it would have to be an issue on the emulator side. The emulator runs a web server which is required for the second+ messages to work. Tom designed it assuming that it would be run on localhost so maybe there's something blocking the incoming request since they're coming from a different machine.

Thanks, just to be clear, this is also an issue with testing with Facebook connected to BotConnector.

We're working on it. Having a hard time nailing it down.

We finally tracked down the issue. I just published v0.11.1 which should resolve the issue. Sorry about that.

ok, I'm closing this item. Let me know if you want me to open a new one, related to _Emulator_ not working as expected with this case.

Hi,
I have written a dummy bot using the latest botbuilder version : 3.4.4. My sample code is:
var server = restify.createServer();
server.listen(config.port,config.ip,function () {
try{
console.log('%s listening to %s', server.name, server.url);
console.log("Welcome to Banker Bot!!!!");
}
catch(err){
console.log("Server already in Use" + err);
}

});
var connector = new builder.ChatConnector({
appId: config.MICROSOFT_APP_ID,
appPassword: config.MICROSOFT_APP_PASSWORD

});
var bot = new builder.UniversalBot(connector);
server.post('/api/messages', connector.listen());
var recognizer = new builder.LuisRecognizer(config.model);
bot.dialog('/', [
function (session) {
session.beginDialog('/askName');
},
function (session, results) {
session.send('Hello %s!', results.response);
}
]);
bot.dialog('/askName', [
function (session) {
builder.Prompts.text(session, 'Hi! What is your name?');
},
function (session, results) {
session.endDialogWithResult(results);
}
]);
I am trying to talk to my bot using emulator. I am able to connect to bot as I get : "ChatConnector: Message Received" when I type anything, then I get a session.error(). Please guide me as to where I am going wrong. I am completely novice to chatbot and nodejs.
Thanks in advance

I don't see anything obviously wrong. Could you please start a new issue versus adding on to a closed one? Thanks!

Was this page helpful?
0 / 5 - 0 ratings