Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why I am getting POST 404 when Calendly is posting data to my endpoint

I created Calendly Webhook Subscription by following their instructions. My backend is written in NodeJS + Express. I am trying to implement Calendly webhook while I got the trial period. I am exposing the endpoint /webhooks/calendly/calendlyWebhook on localhost:8080 and I am doing it through ngrok, because Calendly supports only https protocol. I see in my logs Calendly sending a post request to the endpoint, but I am seeing it being 404: POST /webhooks/calendly/calendlyWebhook 404.

Here is my webhook file called calendlyWebhook.js

const { Router } = require('express');

const calendlyWebhookRouter = Router();

calendlyWebhookRouter.post('/calendlyWebhook', async (req, res) => {
  console.log("Hello from calendly webhook âś…")
  return res.statusCode(200).send('Ok')
})

module.exports = {
  calendlyWebhookRouter,
};

And here is my index.js file where I initialize the router

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

...
...

const {calendlyWebhookRouter} = require('./webhooks/calendlyWebhook');
app.use('/webhooks/calendly/calendlyWebhook', calendlyWebhookRouter);

...

What exactly I am doing wrong?

>Solution :

The webhook route contains calendlyWebhook twice (once in the app.use path and once in the calendlyWebhookRouter path). As a result, calendlyWebhookRouter will only be called when a POST request is sent to /webhooks/calendly/calendlyWebhook/calendlyWebhook.

Removing calendlyWebhook from the app.use route path should resolve the issue:

app.use('/webhooks/calendly', calendlyWebhookRouter);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading