export const createMeeting = async ({
topic,
start_time,
duration,
timezone,
settings = {},
access_token,
}: CreateMeetingParams): Promise => {
if (!access_token) {
throw new Error(“Access token is required to create a Zoom meeting.”);
}
if (!topic || !start_time || !duration || !timezone) {
throw new Error(“Missing required meeting parameters.”);
}
try {
const response = await axios.post(
“{zoom api to create meeting}”,
{
topic,
type: 2, // Scheduled meeting
start_time,
duration,
timezone,
settings:{
“approval_type”:0,
“registration_type”:1,
“waiting_room”:true,
“contact_name”:“Host’s name”,
“registrants_email_notification”:false,
“meeting_authentication”:false,
…settings
}
},
{
headers: {
Authorization: `Bearer ${access_token}`,
"Content-Type": "application/json",
},
}
);
return response.data;
} catch (error: any) {
const message =
error?.response?.data?.message || “Failed to create Zoom meeting.”;
throw new Error(message);
}
};
this is creating meeting but unable to create registration enabled meeting which i require to register registrants so that i can call the api to mark attendance of users which were present in the meeting, cause the report is only available if registrants are present in the meeting