kengz / aiva

AIVA (A.I. Virtual Assistant): General-purpose virtual assistant for developers.
http://kengz.me/aiva/
MIT License
822 stars 595 forks source link

I am in complete darkness when trying to make AIVA work with Facebook Messenger #33

Closed VansonLeung closed 7 years ago

VansonLeung commented 7 years ago

Tried to follow steps by registering & installing ngrok and reading documentations of Hubot. But still in vain when AIVA tries to setup web hook with Facebook

[Sat Jan 07 2017 15:49:23 GMT+0000 (UTC)] INFO FB-adapter initialized
[Sat Jan 07 2017 15:49:31 GMT+0000 (UTC)] ^[[32mINFO^[[39m global-client-js 1e3RZI4gNFgOjz8dAAAB joined, 2 remains
[Sat Jan 07 2017 15:49:31 GMT+0000 (UTC)] INFO subscribed app to page: {"success":true}
[Sat Jan 07 2017 15:49:32 GMT+0000 (UTC)] INFO FB webhook set/updated: {"error":{"message":"(#2200) Callback verification failed with the following errors: HTTP Status Code = 502; HTTP Message = Bad Gateway","type":"OAuthException","code":2200,"fbtrace_id":"D9B6\/qYRiGg"}}

My AIVA setup:

{
  "BOTNAME": "aivadev",
  "PORTS": {
    "NEO4J": 7476,
    "SOCKETIO": 6466,
    "SLACK": 8345,
    "TELEGRAM": 8443,
    "FB": 8545
  },
  "NGROK_AUTH": "5Q45TLi2hCPk4nvWsxpHo_3mXYf4z7PjJqXXXXXXXX",
  "ADMINS": ["your_chat_account@email.com"],
  "ACTIVATE_IO_CLIENTS": {
    "ruby": false,
    "python": true
  },
  "ADAPTERS": {
    "SLACK": {
      "ACTIVATE": false,
      "HUBOT_SLACK_TOKEN": "add custom slack bot https://my.slack.com/services/new/bot"
    },
    "TELEGRAM": {
      "ACTIVATE": false,
      "TELEGRAM_TOKEN": "get from bot father https://core.telegram.org/bots#3-how-do-i-create-a-bot",
      "BOTNAME": "your bot name from bot father",
      "WEBHOOK_KEY": "TELEGRAM_WEBHOOK"
    },
    "FB": {
      "ACTIVATE": true,
      "FB_PAGE_ID": "254764828034XXX",
      "FB_APP_ID": "948466065252XXX",
      "FB_APP_SECRET": "e1c75419d1fcafb1967c92afXXXXXXXX",
      "FB_PAGE_TOKEN": "EAANenZCbmojMBAHadI1dj6fZCGbEv2NEY5x0jAF6NLYOMtm9YIhmrvwGoYktc5BYlgL93aUQGdWb8R2td8xSoGF9C5ZAcjo22gbrAgaIjlimaZBS6jVAUPZAZAfbzVb6gxZCt2N6iFV3yLy6ZB6uqs7JtDfQXCgQqSdXXXXXXXXXXXXXXXX",
      "FB_AUTOHEAR": true,
      "WEBHOOK_KEY": "FB_WEBHOOK_BASE",
      "FB_WEBHOOK_BASE": "optional: set a persistent webhook url if you have one on ngrok, since FB takes 10 mins to update it",
      "FB_ROUTE_URL": "/fb"
    }
  },
  "TEST": {
    "HUBOT_SHELL_USER_ID": "ID0000001",
    "HUBOT_SHELL_USER_NAME": "alice"
  }
}

Could you tell me some more thorough steps to make it work?

kengz commented 7 years ago

in your config, remove the dummy values from the example, otherwise they get read and used. The line:

"FB_WEBHOOK_BASE": "optional: set a persistent webhook url if you have one on ngrok, since FB takes 10 mins to update it",

it seems you have an ngrok key, if u have a persistent address/url on ngrok, set it here, otherwise remove the key/set it to null.