WilianZilv / angoole

Google bridge for Facebook Messenger
41 stars 4 forks source link

Angoole

Angoole is a Facebook Messenger bot that reads the messages, search it on Google search and output back the results for the user.

Configuration steps

Project folder

We need to make a small change in the project folder to continue the process.

.env

First, rename the .template.env to .env

Verify Token

To facebook start using the bot, we need to generate a token for the bot, i used https://randomkeygen.com/ to generate mine, so get a token for you, copy it, open the .env and overwrite the VERIFY_TOKEN= with your token.

Facebook

To make it work, we need a Facebook page, so go there and create it. Next, we need to create a Facebook App, go to https://developers.facebook.com/ (create an account if you don't have one). Go to My Apps > Create App and follow the steps shown. Once you land on the app page, go to Products and click on configure in the Messenger product.

Access Tokens

Inside this block, we need to add our page to get the page access token so we can send messages using the Messenger Api. Click on Add or remove pages, log in, select your page and follow the shown steps. Your page will be displayed in the list and next to it there will be a Generate Token, click on it and copy your page token. Next, open the .env and overwrite the PAGE_TOKEN= with your token.

Webhooks

To configure webhooks, we first need to run our app, you can either run it with $ npm start or

$ docker-compose up(recommended)

Without Docker Compose

Run npm install and then npm start

With Docker Compose

Just run $ docker-compose up

Now bot is running locally, we need to make it accessible in the internet, you can use a server or openning your ports, in my case i use ngrok to generate a public address to access my local service.

Once you get it running publicly, add your URL. Ex: https://myurl.com/webhook And paste your Verify Token, hit verify and save. Now click on Add signatures and select messages and messages_postbacks, hit save and you are done! The bot is working for developers and testers. Go there and send a message to the bot!

I will not cover the process to make it public for everyone