Facebook Messenger Platform. Setting up webhook with SSL

Mr.D picture Mr.D · Apr 13, 2016 · Viewed 12.8k times · Source

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.

Answer

ndrx42 picture ndrx42 · Apr 13, 2016

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