Enable Webhooks#
If you need to integrate OpenVidu with other services, you can use webhooks to send notifications about events that occur in your OpenVidu deployment. This guide explains how to enable webhooks.
OpenVidu Server Configuration#
- SSH into one of your Master Nodes (or Single Node).
-
Add to the file
livekit.yaml
the following configuration:The file is located at:
- Single Node:
/opt/openvidu/config/livekit.yaml
- Elastic / High Availability:
/opt/openvidu/config/cluster/media_node/livekit.yaml
Make sure the
webhook
section exists in the file, and if it doesn't, add it as stated in the previous snippet. Then, add the URL where you want to receive the webhook notifications. In this example,<YOUR_WEBHOOK_URL>
is the URL where you want to receive the notifications. - Single Node:
-
Restart the Master Node (or Single Node) to apply the changes:
This command will restart the services which changed their configuration files in your entire OpenVidu deployment.
PRO V2 Compatibility Configuration#
If you are using the V2 Compatibility module, you can also enable webhooks for the V2 Compatibility layer.
- SSH into one of your Master Nodes (or Single Node).
-
Add to the file
v2compatibility.env
the following parameters:Where
<YOUR_WEBHOOK_URL>
is the URL where you want to receive the notifications.Check in the Configuration Reference all the webhook events that you can receive setting up the parameter
V2COMPAT_OPENVIDU_WEBHOOK_EVENTS
.
Send Webhooks to a Local Application Server#
When developing locally pointing to a production deployment and webhooks events are required by your application, you will face issues because OpenVidu cannot access your local application server.
To receive webhooks from OpenVidu on your local machine, you need to expose your local application server to the internet. This exposure allows OpenVidu to send webhooks directly to your application server.
The following images illustrate the difference between an unreachable and a reachable local application server:
Exposing your local application server to the internet is a common practice when developing applications locally. Tools like Ngrok, LocalTunnel, LocalXpose and Zrok can help you achieve this.
These tools provide you with a public URL that forwards requests to your local application server. You can use this URL to receive webhooks from OpenVidu, configuring it in the OpenVidu Server as explained in the previous section.