Charca / bootbot

Facebook Messenger Bot Framework for Node.js
MIT License
974 stars 254 forks source link

verifyToken unmatch #121

Open AlexAndrei98 opened 6 years ago

AlexAndrei98 commented 6 years ago

Whenver I try to initalize the bot on heroku I get this error. However, if I try to initialize it with the provided code from facebook it will not give me any errors. Anyone knows why? Failed validation. Make sure the validation tokens match.

this is my code

'use strict';
const BootBot = require('bootbot');
const PAGE_ACCESS_TOKEN = process.env.PAGE_ACCESS_TOKEN;
const VERIFY_ACCESS_TOKEN = process.env.VERIFY_ACCESS_TOKEN;
const APP_SECRET_TOKEN = process.env.APP_SECRET_TOKEN;
const bot = new BootBot({
  accessToken: PAGE_ACCESS_TOKEN,
  verifyToken: VERIFY_ACCESS_TOKEN,
  appSecret: APP_SECRET_TOKEN

});

bot.on('message', (payload, chat) => {
    const text = payload.message.text;
    console.log(`The user said: ${text}`);
});

bot.hear(['hello', 'hi', /hey( there)?/i], (payload, chat) => {
    console.log('The user said "hello", "hi", "hey", or "hey there"');
});
bot.start();
mraaroncruz commented 6 years ago

First: Is this error happening in the facebook modal or in the console where you're running your bot?

This could be a misspelling in heroku config? run heroku config:get VERIFY_ACCESS_TOKEN -a your_app_name Is it the same as you are adding in facebook? Also, facebook is notorious with being the awful with caching (over caching). If above isn't the case, delete the webhook and re-add it in the messenger admin.