我通过跟踪他们的使用说明创建了CalendlyWeb钩子订阅。我的后端是用NodeJS + Express编写的。我正在尝试实现Calendly的网页钩子,而我有试用期。我在localhost上公开端点/webhooks/calendly/calendlyWebhook:8080,并且我是通过ngrok这样做的,因为Calendly只支持https协议。我在日志中看到Calendly向端点发送post请求,但我看到它是404:POST /webhooks/calendly/calendlyWebhook 404。
这是我的web钩子文件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,
};这是我的index.js文件,我在这里初始化路由器
...
...
const {calendlyWebhookRouter} = require('./webhooks/calendlyWebhook');
app.use('/webhooks/calendly/calendlyWebhook', calendlyWebhookRouter);
...我到底做错了什么?
发布于 2022-04-17 15:37:00
Web钩子路由包含calendlyWebhook两次(一次在app.use路径中,一次在calendlyWebhookRouter路径中)。因此,只有当POST请求发送到calendlyWebhookRouter时才会调用/webhooks/calendly/calendlyWebhook/calendlyWebhook。
从calendlyWebhook路由路径中删除app.use应该可以解决以下问题:
app.use('/webhooks/calendly', calendlyWebhookRouter);https://stackoverflow.com/questions/71903054
复制相似问题