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:
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.
Parse error: syntax error, unexpected ',', expecting variable (T_VARIABLE)
. How to run that code and verify my weebhook? – Tiresias