Room
Creating a Room
The following example shows how to call the private API to create a Room.
In production, call this from your backend using your company’s API key. For development and testing, you can run it in your frontend to verify your integration without backend setup.
file.ts
export const createRoomService = () => {
const opts = {
method: 'POST',
headers: {
'content-type': 'application/json',
'Authorization': `Bearer ${'your-api-key'}`
},
body: JSON.stringify({
arguments: [
{
metadata: { name: 'exampleRoomName' },
kind: 2,
retention: 86400000000000
}
]
})
};
return fetch('https://room.dev.zu.casa/room.rooms.private.v1.Service/Create', opts)
.then(res => {
return res.json();
})
.then(res => {
return res.rooms[0];
})
}⚠️
Never expose in production your API KEY generation logic to the client. Always create rooms from a secure backend in production.