Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const bodyParser = require('body-parser')
const express = require('express')
const Wit = require('node-wit').Wit
const log = require('node-wit').log
const Bot = require('./bot')
const getimage = require('./image-search.js')
const config = require('./config')
let bot = new Bot(config);
// Our bot actions
const actions = {
/**
* This is used by the "Bot sends" action in Wit
* @param sessionId
* @param text
* @param quickreplies
* @returns {Promise.}
*/
send({sessionId}, {text, quickreplies}) {
// 6. Talk to your bot on Messenger!
const bodyParser = require('body-parser');
const crypto = require('crypto');
const express = require('express');
const fetch = require('node-fetch');
let Wit = null;
let log = null;
try {
// if running from repo
Wit = require('../').Wit;
log = require('../').log;
} catch (e) {
Wit = require('node-wit').Wit;
log = require('node-wit').log;
}
// Webserver parameter
const PORT = process.env.PORT || 8445;
// Wit.ai parameters
const WIT_TOKEN = process.env.WIT_TOKEN;
// Messenger API parameters
const FB_PAGE_TOKEN = process.env.FB_PAGE_TOKEN;
if (!FB_PAGE_TOKEN) { throw new Error('missing FB_PAGE_TOKEN') }
const FB_APP_SECRET = process.env.FB_APP_SECRET;
if (!FB_APP_SECRET) { throw new Error('missing FB_APP_SECRET') }
let FB_VERIFY_TOKEN = null;
crypto.randomBytes(8, (err, buff) => {