title: Facebook Messenger Platform. Setting up webhook with SSL
body: <p>Finally Facebook launched API for their messenger <a href="http://thenextweb.com/dd/2016/04/12/facebook-messenger-chatbot-platform/#gref" rel="noreferrer">API for their messenger</a>. This will allow us to create chat bots.</p>
  
  <p><a href="https://developers.facebook.com/docs/messenger-platform/quickstart" rel="noreferrer">In getting started guide</a>, I need to setup webhook. This requires webserver which resides in specific domain and must use SSL connection.</p>
  
  <p>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:</p>
  
  <pre><code>app.get('/webhook/', function (req, res) {
    if (req.query['hub.verify_token'] === '&lt;validation_token&gt;') {
        res.send(req.query['hub.challenge']);
    }
    res.send('Error, wrong validation token');
  })
  </code></pre>
  
  <p>Then I launched this server application and In my facebook app dashboard I click to <strong>Verify and Save</strong> button.</p>
  
  <p>It throws me this error message:</p>
  
  <p><a href="https://i.stack.imgur.com/boRqU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/boRqU.png" alt="Screenshot"></a></p>
  
  <p>This means that <strong>Facebook does not want to accept my self signed certificate</strong>.</p>
  
  <p>This brings a several questions:</p>
  
  <p>Do I need to use SSL certificates <strong>only provided by Certificate Authorities</strong> in order to work with facebook messenger?</p>
  
  <p>Working with Facebook messenger is far more difficult than Telegram.</p>