Botkit: New web bot created with `yo botkit`, ReferenceError: BotkitConversation is not defined

Created on 30 Jul 2019  路  6Comments  路  Source: howdyai/botkit

I just installed the Yeoman generator for botkit and created a new bot with the web adapter template. I get an error when running it using npm start.

[...]/botkit-weberror/features/typing.js:7
    let typing = new BotkitConversation('typing', controller);
                 ^

ReferenceError: BotkitConversation is not defined

Steps

Follow the steps on https://botkit.ai/getstarted.html

  1. npm install -g yo generator-botkit
  2. Create & change directory
  3. yo botkit
  4. Name the bot, select "web" as messaging platform
  5. No MongoDB persistence URI (or set one valid, the result is the same)
  6. Run npm start

Result

image

Expected

I would expect the bot to start and run correctly.

When I delete the file features/typing.js, the project starts.

Context:

  • Botkit version: 4.5.0
  • [email protected]
  • Messaging Platform: botbuilder-adapter-web 1.0.4
  • Node version: 10.16.0, NPM version 6.9.0
  • Os: MacOS 10.14.5
bug generator

Most helpful comment

You should add this to your features/typing.js

const { BotkitConversation } = require("botkit");

All 6 comments

You should add this to your features/typing.js

const { BotkitConversation } = require("botkit");

Thank you for the bug report. I will issue an update to the generator ASAP.

Thanks gentlemen the quick reply.

@valentinkauth ; the fix you suggested works.

I just started looking into botkit; the framework looks amazing.

Thanks, @etiennellipse! Lots of people have helped to make it what it is!

Just pushed 4.5.1 of the generator. Thanks again for the report!

I still keep getting the same error actually:

/**

  • Copyright (c) Microsoft Corporation. All rights reserved.
  • Licensed under the MIT License.
    */

module.exports = function(controller) {

/**
 * Detect when a message has a sticker attached
 */
controller.hears(['buenas noches','buenas tardes','buen dia','hola','como estas','que haces','permiso'], 'message', async function(bot, message) {

    var recruit_id = 'recruit_conversation'; 
    var recruit_convo = new BotkitConversation(recruit_id,controller);
    recruit_convo.say('Hola! Bienvenido al servicio de reclutamiento');
    recruit_convo.say('Te vamos a hacer las siguientes preguntas para conformar tu perfil en nuestro sistema.');
    recruit_convo.ask(' tuviste entrevista previa con nosotros?');



});

}

Was this page helpful?
0 / 5 - 0 ratings