Didn't receive any Webhook on my endpoint v2.29.0

Hi team, following the guide how to set up a webhook here:OpenVidu Webhook - OpenVidu Docs

In order to play with them and get a first approach, I’ve created an endpoint POST within the Application Server (I’m usign the openvidu-basic-node)

app.post(“/webhook”, async (req, res) => {
var response = req.body;
console.log(“webhook called”, response);
res.status(200).send(“ok”);
});

and I’m pointing to it on Openvidu server config

“OPENVIDU_WEBHOOK”: true,
“OPENVIDU_WEBHOOK_ENDPOINT”: “http://localhost:5000/webhook”,
“OPENVIDU_WEBHOOK_HEADERS”: ,
“OPENVIDU_WEBHOOK_EVENTS”: [
“sessionCreated”,
“sessionDestroyed”,
“participantJoined”,
…]

Unfortunately I couldn’t received any webhook when ex. I create a session an join to it etc…
What I miss or made wrong?

thanks a lot

Try reviewing openvidu-server logs. There you will find webhook related messages that should explain why events are not reaching your endpoint.

I’ve reviewed openvidu-server logs and the error is failed: Connection refused (Connection refused)

via Postman I can reach it out with status 200. What can I do?

This simply means that your openvidu-server is not able to reach URI http:/127.0.0.1:5000/webhook.

If you have deployed OpenVidu as the official instructions state, this is normal. You are trying to reach a “localhost” direction from inside a Docker container (openvidu/openvidu-server). When you use POSTMAN I am guessing you are running it from the localhost itself where your webhook receiver is up and running. That’s why POSTMAN is able to reach 127.0.0.1 but openvidu-server is not.

If you want to host your webhook server in the same machine as openvidu-server, you need the IP gateway of Docker. With that you can access “localhost” from within the Docker container openvidu/openvidu-server. Just run this command:

docker network inspect bridge --format='{{(index .IPAM.Config 0).Gateway}}'

And replace "OPENVIDU_WEBHOOK_ENDPOINT": "http://localhost:5000/webhook" with "OPENVIDU_WEBHOOK_ENDPOINT": "http://<WHATEVER_IP_THE_COMMAND_RETURNS>:5000/webhook"