@huddle01/server-sdk v2.2.2
@huddle01/server-sdk
Installation
npm install @huddle01/server-sdk
yarn add @huddle01/server-sdk
pnpm i @huddle01/server-sdk
bun install @huddle01/server-sdk
Usage
Webhooks
Helper functions to decode and verify webhook callbacks from Huddle01.
import { WebhookReciever } from '@huddle01/server-sdk/webhooks';
const webhookReciever = new WebhookReciever({
apiKey: "YOUR_API_KEY",
apiSecret: "YOUR_API_SECRET",
});
Next.js Api Route
export async function POST(request: Request) {
try {
const body = await request.json();
const header = request.headers.get("huddle01-signature");
const data = webhookReciever.recieve(body, header);
console.log({ webhookData: data });
return NextResponse.json({ ok: true });
} catch (error) {
console.error(error);
return NextResponse.json({ ok: false }, { status: 500 });
}
}
Express
app.post("/webhooks", async (req, res) => {
try {
const body = req.body;
const header = req.headers["huddle01-signature"];
const data = webhookReciever.recieve(body, header);
console.log({ webhookData: data });
res.status(200).json({ ok: true });
} catch (error) {
console.error(error);
res.status(500).json({ ok: false });
}
});
Helper to get properly typed data from webhook
const recievedData = webhookReciever.recieve(body, header);
/**
* @returns {
* event: "meeting:started",
* data: {
* roomId: string,
* createdAt: string,
* }
* }
*/
const { event, data } = webhookReciever.createTypedWebhookData(
"meeting:started",
data.payload,
);
TODO: docs for auth and recorder
23 days ago
23 days ago
23 days ago
23 days ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago