How to use the botkit.socketbot function in botkit

To help you get started, we’ve selected a few botkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github D2KLab / music-chatbot / bot.js View on Github external
var dialogflowMiddleware = require('botkit-middleware-dialogflow')({
    token: process.env.dialogflow,
	sessionIdProps: ['channel'],
});


// WEBCHAT
var webchatBotOptions = {
    replyWithTyping: true,
    debug: false,
};
var webchatConfig = {
    baseUrl: process.env.webchatBaseUrl || '/',
    port: process.env.webchatPort
}
var webchatController = Botkit.socketbot(webchatBotOptions);
var webchatBot = webchatController.spawn({
    token: process.env.webchatToken,
    retry: 10,
});
// Set up an Express-powered webserver to expose oauth and webhook endpoints
require('./webchat/components/express_webserver.js')(
    webchatController,
    webchatConfig,
);
// Open the web socket server
webchatController.openSocketServer(webchatController.httpserver);
// Start the Web bot controller
webchatController.startTicking();


// SLACK: 'SpellChecker' MIDDLEWARE INIT
github howdyai / botkit-starter-web / bot.js View on Github external
studio_stats_uri: process.env.studio_command_uri,
    replyWithTyping: true,
};

// Use a mongo database if specified, otherwise store in a JSON file local to the app.
// Mongo is automatically configured when deploying to Heroku
if (process.env.MONGO_URI) {
  // create a custom db access method
  var db = require(__dirname + '/components/database.js')({});
  bot_options.storage = db;
} else {
    bot_options.json_file_store = __dirname + '/.data/db/'; // store user data in a simple JSON format
}

// Create the Botkit controller, which controls all instances of the bot.
var controller = Botkit.socketbot(bot_options);

// Set up an Express-powered webserver to expose oauth and webhook endpoints
var webserver = require(__dirname + '/components/express_webserver.js')(controller);



// Load in some helpers that make running Botkit on Glitch.com better
require(__dirname + '/components/plugin_glitch.js')(controller);

// Load in a plugin that defines the bot's identity
require(__dirname + '/components/plugin_identity.js')(controller);

// enable advanced botkit studio metrics
// and capture the metrics API to use with the identity plugin!
controller.metrics = require('botkit-studio-metrics')(controller);