node.js - BotBuilder TypeError: builder.ConsoleConnector is not a constructor


Question: 

I'm following the official quick start of Microsoft Bot Builder(SDK v3) for NodeJs: Create a bot with the Bot Builder SDK for Node.js

1- I made a new project with

npm init

2- then

npm install --save botbuilder

3- then I created a new file "app.js"

var builder = require('botbuilder');

var connector = new builder.ConsoleConnector().listen();
var bot = new builder.UniversalBot(connector, function (session) {
session.send("You said: %s", session.message.text);
});

But when I run "node app.js" the following error is thrown:

var connector = new builder.ConsoleConnector().listen();
            ^

TypeError: builder.ConsoleConnector is not a constructor

Could anyone help me, please?

My project structure:

enter image description here




1 Answer: 

There is a mismatch between the documentation and the latest release of the botbuilder package (version 4.0.6) features / methods. Microsoft has changed some of the legacy features of the botbuilder npm package, but they haven't updated their doc yet!

The JavaScript code which is present in Microsoft's Documentation won't work for the same reason!

Try with the botbuilder package version 3.13.1 , it will work perfectly.

To Install:

npm i -S botbuilder@3.13.1

And your piece of code will work!

Find the snapshots:

code

package.json

Cheers!!

 

More Articles


asp.net mvc - Payment Gateway returns Error HTTP Status - 400

I’m trying to redirect my MVC project to pay migs payment Gateway.Here’s the URL generated by my code. (For security reasons i have changed the value with the word “value” )https://migs.mastercard.com.au/vpcpay?vpc_AccessCode=value&vpc_Amount=100&vpc_Command=pay&vpc_Locale=en&vpc_Me

WebSocket closing immediately using Watson Speech-to-text JS SDK

Trying to use this code from a provided demo, using the latest watson-speech.js from https://github.com/watson-developer-cloud/speech-javascript-sdk:document.querySelector('#button').onclick = function () { fetch('myserverurl/api/token') .then(function(response) { return response.text(); }).

node.js - Microsoft Botframework Prompts.choice not getting validation response

I am using chatconnector to connect my Bot to an frontend chat app and writing the bot's response to my own database. The problem is when I am validating a prompt the bot responds but there's no API for me to grab the validation response. bot.dialog('/', [function (session) { builder.Prompts.cho


node.js - Firebase calling `child(all).equalTo(id)`

I like to check all children that contains a child with a value to the variable id.This is what I came up with:usersref.child(formData.openid + '/votes').child().equalTo(formData.appid).once('value', function(snapshot) {});This returned: Firebase.child failed: Was called with 0 arguments. Expects at

node.js - Get data having a maximum attribute from firebase in nodejs

So i am working with firebase in nodejs, there is a "number" attribute in each of my document of a specific table(name generated at runtime). I want to get the data having the attribute "number"'s maximum value.Here is my sample data:- -L1GIb7Vyn6Yhd5gghH0 correct: blah number: 9 questio

Logs showing WARNING when trying to credit bank accounts with Balanced Payments

Been seeing this in my logs today. ############################################################# # WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! # ############################################################# Using positional arguments is **DEPRECATED**. Please use the keyword optio


node.js - Correct way to send response when using Actions-on-google with koa.js

I'm trying to use actions-on-google with koa framework. I can't understand which request and response to use with AoG constructor in koa middleware. This is my code:const Koa = require( 'koa' )const koaBody = require('koa-body')const { DialogflowApp } = require('actions-on-google')const koaApp = new

actions on google - Implementing Conversation Webhook as Azure Function App

I have an azure function app that I am using as a webhook for my google assistant action. I've tried to follow the documentation for the proper response but I continually get the following error in the simulator when testing my webhook. Is there anything in my response message that looks wrong?Fai

java - Paypal expressCheckout integration (DoExpressCheckout) error

I have a ExpressCheckout integration setup in java google app engine and it working up to GetExpresschekout .but in finall call(DoExpressCheckout) I am unable to Authorize payment .it returnsan errorRESULT=1000&PNREF=E24P1FBB8FA4&RESPMSG=Generic processor error: 13116-The transaction is in p

c# - Set time limit for items in container in CosmosDB using Microsoft.Bot.Builder.Azure (bot framework v4)

I want to set the time to live for the items in a container in cosmosDB, but I am not sure how to do so using the config of cosmosdb storage in bot framework v4. I would appreciate some help on this matter.I have read about setting time to live using DocumentClient() as documented here. However I se