microsoft / BotFramework-Emulator

A desktop application that allows users to locally test and debug chat bots built with the Bot Framework SDK.
https://aka.ms/botemulator
MIT License
1.82k stars 755 forks source link

could not get response from bot #424

Closed ajaykumar1452 closed 6 years ago

ajaykumar1452 commented 6 years ago

hi , i have created a sample bot and integrated with LUIS by creating intents and mappings, u see can code in below screen shot, the issue is i could not get response from bot to Emulator. node js bot code

----------------------------------Emulator-------------------------------------- response from bot


below is the code for above screen shot.

/----------------------------------------------------------------------------- A simple echo bot for the Microsoft Bot Framework. -----------------------------------------------------------------------------/

var restify = require('restify');
var builder = require('botbuilder'); var botbuilder_azure = require("botbuilder-azure");

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

// Create chat connector for communicating with the Bot Framework Service var connector = new builder.ChatConnector({ appId: '', appPassword: '', openIdMetadata: process.env.BotOpenIdMetadata });

// Listen for messages from users server.post('/api/messages', connector.listen());

/*----------------------------------------------------------------------------------------

var tableName = 'botdata'; var azureTableClient = new botbuilder_azure.AzureTableClient(tableName,process.env.AzureTableName);// process.env.AzureTableKeyprocess.env['AzureWebJobsStorage'] var tableStorage = new botbuilder_azure.AzureBotStorage({ gzipData: false }, azureTableClient);

// Create your bot with a function to receive messages from the user var bot = new builder.UniversalBot(connector); bot.set('storage', tableStorage);

// Make sure you add code to validate these fields var luisAppId ='XXXXXXXXXXXXXXXXXXXXXXXXXXX'; var luisAPIKey ='XXXXXXXXXXXXXXXXXXXXXXXXXXX'; var luisAPIHostName = process.env.LuisAPIHostName || 'westus.api.cognitive.microsoft.com';

const LuisModelUrl = 'https://' + luisAPIHostName + '/luis/v1/application?id=' + luisAppId + '&subscription-key=' + luisAPIKey;

// Main dialog with LUIS //console.log(LuisModelUrl); var recognizer = new builder.LuisRecognizer(LuisModelUrl);

var intents = new builder.IntentDialog({ recognizers: [recognizer] }) .matches("weather",(session,args)=>{ console.log(JSON.stringify(args));

session.send('you asked for weather'+JSON.stringify(args));   

}) .matches('greeting',(session,args)=>{

session.send('Hi you!');    

}) .onDefault((session) => { session.send('Sorry, I did not understand \'%s\'.', session.message.text); });

bot.dialog('/', intents);

JasonSowers commented 6 years ago

@ajaykumar1452 Would you please post this question in the main botbuilder repository. We will be happy to assist you over there in diagnosing your issue.