14

I'm trying to setup the Facebook messenger API and I'm getting this error when I attempt to add the WebHook:

The URL couldn't be validated. Callback verification failed with the following errors: curl_errno = 60; curl_error = SSL certificate problem: unable to get local issuer certificate; HTTP Status Code = 200; HTTP Message = Connection established

I've setup my NodeJS server using the code they provided in the tutorial. Here's the url: https://stackoverload.me/chatter/webhook

EDIT HERE'S THE RESOLUTION (someone wanted to see the code):

var express = require('express');

var fs = require('fs');
var https = require('https');

var app = express();
app.use(express.static('public'));

// SSL
https.createServer(
    {
        ca: fs.readFileSync(__dirname + '/server.ca'),
        key: fs.readFileSync(__dirname + '/server.key'),
        cert: fs.readFileSync(__dirname + '/server.cert')
    }
, app).listen(443, function() {
    console.log('Server is now running.');
});

// HTTP redirect to SSL
express()
    .get('*', function(req,res){
        res.redirect('https://example.com' + req.url)
    })
    .listen(80);
dmulter
  • 2,608
  • 3
  • 15
  • 24
Jake Cross
  • 523
  • 1
  • 6
  • 14
  • 2
    You’re missing an intermediate certificate in the chain, so your certificate can not be verified as genuine. https://www.sslshopper.com/ssl-checker.html#hostname=stackoverload.me has instruction on what to do. – CBroe Apr 12 '16 at 19:48
  • @CBroe I am facing the same error, though I am deploying on parseapp.com, any idea? – dhaval Apr 13 '16 at 13:55
  • 2
    I added a CA file to my server and it worked fine – Jake Cross Apr 13 '16 at 19:33
  • I checked my SSL configuration from [sslshopper.com](https://www.sslshopper.com/ssl-checker.html#hostname=akillidergi.com) but I didn't see any mistake. Can you share your nodejs code? – ozgrozer Apr 13 '16 at 19:50
  • Uploaded the code. – Jake Cross Apr 13 '16 at 19:55
  • Wow. Thank you man. You saved my day. There is no `ca: fs.readFileSync()` line in the nodejs documentation [page](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener) and this was the only problem. Now it works great. – ozgrozer Apr 13 '16 at 20:22
  • Glad to hear :) You can thank the Namecheap support for that one haha – Jake Cross Apr 14 '16 at 09:39

3 Answers3

5

Forgot to answer this, but I found out that I added a ca file and parameter to my https server and Facebook then accepted it.

Jake Cross
  • 523
  • 1
  • 6
  • 14
0

You can use the chained certificate by the following shell:

cat www.example.com.crt bundle.crt > www.example.com.chained.crt

From http://nginx.org/en/docs/http/configuring_https_servers.html#chains

magicpanda
  • 66
  • 3
0

Was trying to setup FB messenger webhook with a strong verify token. Somewhat like this: o\/ERviEE\/vt0|<E|\|

o/ERviEE/vt0|<E|\| verify token set

The same is been verified in the code:

req.query['hub.verify_token'] === 'o\/ERviEE\/vt0|<E|\|'

However, the value received from FB is: o\\/ERviEE\\/vt0|<E|\\|

o\/ERviEE\/vt0|<E|\|  verify token get

This is strange. There seems to be no document reference as such which talks about how Facebook escapes special characters for verify tokens or alike. Not sure if this happens for other entities as well.

Conclusion: need to be a little bit cautious when using special characters for verify tokens.

Because, Facebook escapes special characters for webhooks' verify tokens.

Zameer Ansari
  • 28,977
  • 24
  • 140
  • 219