Webhooks

Web Hooks

💡

Reachout to the Huddle01 Team to set your webhook URL for your subdomain, you'll be able to set it up from the dashboard soon.

Usage:

import { WebhookReceiver } from "@huddle01/server-sdk/webhooks";
 
const webhookReceiver = new WebhookReceiver({
  apiKey: "YOUR_API_KEY",
});

Express Example to listen to webhooks events

💡

To make the webhook work on localhost, you'll have to use something like ngrok for port forwarding.

import express, { Request, Response } from "express";
import bodyParser from "body-parser";
import { WebhookReceiver } from "@huddle01/server-sdk/webhooks";
 
type Err = { message: string };
 
const receiver = new WebhookReceiver({
apiKey: "YOUR_API_KEY",
});
 
const app = express();
const port: number = 3002;
 
// Middleware to parse JSON bodies
app.use(bodyParser.text());
 
app.post("/", (req: Request, res: Response) => {
try {
const header: string | undefined = req.headers[
"huddle01-signature"
] as string;
 
    const data = receiver.receive(req.body, header);
 
    console.log({ data });
 
    res.status(200).send({ success: true });
 
} catch (error) {
console.error({ error });
}
});
 
app.listen(port, () => {
console.log(`🦊 Express server running at http://localhost:${port}`);
});
 

Events

You can listen to these event on your server side and perform various actions based on the events. Following is the list of events you can listen to:

meeting:started

AttributesType
roomIdstring
createdAtnumber

meeting:ended

AttributesType
roomIdstring
createdAtnumber
endedAtnumber
durationnumber
participantsnumber
maxParticipantsnumber

peer:joined

AttributesType
idstring
roomIdstring
joinedAtnumber
metadatastring?
rolestring?
browserBrowser
deviceDevice

Browser

AttributesType
namestring?
versionstring?

Device

AttributesType
modelstring?
typestring?
vendorstring?

peer:left

AttributesType
idstring
roomIdstring
leftAtnumber
durationnumber
metadatastring?
rolestring?

peer:trackPublished

AttributesType
idstring
trackstring

peer:trackUnpublished

AttributesType
idstring
trackstring

recording:started

AttributesType
idstring
roomIdstring

recording:stopped

AttributesType
idstring
roomIdstring
Audio/Video Infrastructure designed for the developers to empower them ship simple yet powerful Audio/Video Apps.
support
company
Copyright © 2024 Graphene 01, Inc. All Rights Reserved.