devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click!
https://waha.devlike.pro/
Apache License 2.0
806 stars 247 forks source link

Webhook configuration question #384

Closed dg103 closed 1 week ago

dg103 commented 1 week ago

Hi, I'm trying to implement your service on my site. For the part relating to outgoing messages everything works perfectly, but I encounter some problems relating to incoming messages and therefore to the configuration of the webhook. If I use external services for the simulation of HTTP calls (for example MockBin), I notice that the calls start perfectly from the service, but by configuring the session to point it to a webhook (I normally use Glitch, I don't know if it can be relevant) all my calls are bounced back and I receive the error code: POST request was sent with status code: 403

Trivially, the code of my webhook is the following: const express = require('express'); const bodyParser = require('body-parser'); const app = express(); const PORT = process.env.PORT || 3000;

app.use(bodyParser.json());

app.use((req, res, next) => { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE'); res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization'); res.header('Access-Control-Allow-Private-Network', 'true'); next(); });

app.post('/webhook', (req, res) => { console.log('Received webhook request:'); console.log('Headers:', req.headers); console.log('Body:', req.body);

res.status(200).json({ message: 'Webhook received successfully!' }); });

app.listen(PORT, () => { console.log(Server listening on port ${PORT}); });

{ "version": "2024.6.5", "engine": "WEBJS", "tier": "CORE", "browser": "/usr/bin/chromium" }

Is this an error that has already happened to you and are you able to help me resolve it and give me some advice?

devlikepro commented 1 week ago

Try using https://webhook.site/ if it works - check your code one more time

patron:PRO