Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Messenger Platform. Setting up webhook with SSL

Finally Facebook launched API for their messenger API for their messenger. This will allow us to create chat bots.

In getting started guide, I need to setup webhook. This requires webserver which resides in specific domain and must use SSL connection.

I have VPS which has static IP. I made self signed certificate and created simple Node JS web server which uses this certificate. First of all I need to verify token for webhook:

app.get('/webhook/', function (req, res) {
  if (req.query['hub.verify_token'] === '<validation_token>') {
      res.send(req.query['hub.challenge']);
  }
  res.send('Error, wrong validation token');
})

Then I launched this server application and In my facebook app dashboard I click to Verify and Save button.

It throws me this error message:

Screenshot

This means that Facebook does not want to accept my self signed certificate.

This brings a several questions:

Do I need to use SSL certificates only provided by Certificate Authorities in order to work with facebook messenger?

Working with Facebook messenger is far more difficult than Telegram.

like image 563
Mr.D Avatar asked Apr 13 '16 04:04

Mr.D


People also ask

Is there a Facebook Messenger API?

The Messenger Profile API allows you to set, update, retrieve, and delete properties from the Page Messenger Profile.


2 Answers

You can use cloudflare to get https instead of self-sign. Or you can use https://letsencrypt.org

like image 30
saturngod Avatar answered Oct 10 '22 00:10

saturngod


For just test you can use localtunnel. https://localtunnel.me/

like image 128
eayurt Avatar answered Oct 10 '22 02:10

eayurt