Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fb = require('./fb');
const apiai = require('./api-ai.js');
const botmetrics = require('./bot-metrics.js');
const dashbot = require('dashbot')(process.env.DASHBOT_API_KEY).facebook;
const sessionStore = require('./session.js')();
const log = require('./log.js');
module.exports = (req, res, next) => {
console.log(' ');
console.log('===Received a message from FB');
res.end();
dashbot.logIncoming(req.body);
console.log(`JSON:${JSON.stringify(req.body)}`);
const entries = req.body.entry;
entries.forEach((entry) => {
const messages = entry.messaging;
messages.forEach((message) => {