[ad_1]
The code you provided to create an event with a conference ID seems correct. The reason why the event is created with a random Google Meet ID instead of the specific one you set is probably due to a different issue.
A possible reason could be that Google Meet video conferencing has not been enabled for the user’s calendar or account. You can check if Meet conferencing is enabled by going to your calendar settings and under the “Event settings” tab, you should see the option to enable Meet for video conferencing.
Another possible reason could be that the requested conference ID is invalid or not recognized by Google. You can verify that the conference ID is valid by checking the Google Meet link associated with the conference ID to see if it works.
To set up Meet ID programmatically using the Google Calendar API, you can create a new conference ID and update the event’s conference data with the new conference ID. Here is sample code that uses the Google Calendar API to create a new conference and update an event:
// Set conference parameters const conferenceRequest = { requestId: Math.random().toString(36).substring(7), conferenceSolutionKey: { type: ‘hangoutsMeet’ } }; // Create a new conference using the Google Calendar API const conferenceData = await gapi.client.calendar.events.create({ calendarId: calendarId, conferenceDataVersion: 1, requestId: conferenceRequest.requestId, createRequest: conferenceRequest.createRequest }). then( (response) => { const conferenceId = response.data.conferenceData.conferenceId; return conferenceId; }).catch((error) => { console.error(‘Error creating new conference:’, error ); }); // Update the event with the new conference data const eventPatch = { conferenceData: { conferenceId: conferenceData, createRequest: conferenceRequest } }; gapi.client.calendar.events.patch({ calendarId: calendarId, eventId: eventId, conferenceDataVersion: 1, resource: eventPatch }).then((response) => { console.log(‘Event successfully updated:’, response) ; }).catch((error) => { console.error(‘Error updating event:’, error); });
This code first creates a new conference using the create method of the calendar.events resource with the specified conference solution key. Then, update the event with the new conference ID by calling the patch method of the calendar.events resource with the new conference data.
|
Sources 2/ https://stackoverflow.com/questions/75785196/create-a-google-calendar-event-with-a-specified-google-meet-id-conferencedata-c The mention sources can contact us to remove/changing this article |
[ad_2]