I deployed a Strapi project and run it through pm2
and nginx
. I have a webhook api in https://zeusoftware.online/api/webhook
. Here is my code for verify the webhook, I didn't implement the token, challenge and mode logic yet.
Controller
module.exports = {
verifyAction: async (ctx, next) => {
console.log(ctx.request.body)
try {
ctx.body = 'ok';
} catch (err) {
ctx.body = err;
}
}
};
Route
module.exports = {
routes: [
{
method: 'GET',
path: '/webhook',
handler: 'webhook.verifyAction',
}
],
};
When I call this in my browser, it returns ok
. But when I goto FB to config the Webhook. It always return the follow error:
The callback URL or verify token couldn't be validated. Please verify the provided information or try again later.
I know I haven't implemented the logic yet. But my question is why the request even doesn't reach my application. I debug this through a console.log
. (When I run in browser, the console.log
works).
I can't find any document about how FB verify this webhook callback API. Any idea?
Found the follow related link. But it doesn't solve my issue.