damp-father-88414
02/25/2025, 8:46 AMgray-monkey-83525
02/25/2025, 8:47 AMapplication/webhook+json
and include an authorization header for security purposes, which contains a signed JWT token to verify the source of the request.
Would you like more detail on how to set up or handle these webhooks?
Sources:
- Webhooks | LiveKit Docs
- LiveKit JS Server SDK - WebhookReceiver 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.damp-father-88414
02/25/2025, 8:48 AMgray-monkey-83525
02/25/2025, 8:48 AMwebhook
section with the api_key
and urls
where the webhooks should be sent.
2. Set Up Your Server to Receive Webhooks:
- Ensure your server can receive HTTP POST requests with the content type application/webhook+json
. The server should be able to handle JSON payloads and verify the JWT token in the Authorization header to ensure the request is from LiveKit.
3. Implement Webhook Receiver:
- Use LiveKit's server SDKs to implement a webhook receiver. For example, in Node.js, you can use the WebhookReceiver
class from the livekit-server-sdk
to validate and decode the webhook payloads.
4. Handle Webhook Events:
- Implement logic to handle different webhook events such as room_started
, participant_joined
, etc. Each event will have specific data that you can use to trigger actions in your application.
Here's a basic example in Node.js:
import { WebhookReceiver } from 'livekit-server-sdk';
import express from 'express';
const app = express();
const receiver = new WebhookReceiver('apikey', 'apisecret');
app.use(express.raw({ type: 'application/webhook+json' }));
app.post('/webhook-endpoint', async (req, res) => {
try {
const event = await receiver.receive(req.body, req.get('Authorization'));
console.log('Received event:', event);
// Handle the event
res.sendStatus(200);
} catch (error) {
console.error('Error processing webhook:', error);
res.sendStatus(400);
}
});
app.listen(3000, () => {
console.log('Server listening on port 3000');
});
Would you like more detailed information on any specific part of this setup?
Sources:
- Webhooks | LiveKit Docs 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.damp-father-88414
02/25/2025, 8:51 AMwebhook
section with the api_key
and urls
where the webhooks should be sent.
explain this step in detail