I’m trying to generate a google meet link and I’m having the error Invalid conference type value.
I creted a service and then genrated a key, downloaded it (service-account-key.json)
and now I am having this error
Error creating Google Meet link: Invalid conference type value
Here’s my code:
const { v4: uuidv4 } = require('uuid');
const path = require('path');
const fs = require('fs');
// Path to the service account key file
const credentialsPath = path.join(__dirname, '../../../utils/service-account-key.json');
const credentials = JSON.parse(fs.readFileSync(credentialsPath, 'utf8'));
const SCOPES = ['https://www.googleapis.com/auth/calendar'];
const auth = new google.auth.JWT(
credentials.client_email,
null,
credentials.private_key,
SCOPES,
null
);
async function createGoogleMeetLink(training) {
const calendar = google.calendar({ version: 'v3', auth });
const event = {
summary: training.title,
description: training.description,
start: {
dateTime: new Date(training.startTime).toISOString(),
timeZone: 'Africa/Tunis',
},
end: {
dateTime: new Date(training.endTime).toISOString(),
timeZone: 'Africa/Tunis',
},
conferenceData: {
createRequest: {
requestId: uuidv4(),
conferenceSolutionKey: {
type: 'hangoutsMeet',
},
},
},
};
console.log('Event to be created:', JSON.stringify(event, null, 2));
try {
const response = await calendar.events.insert({
calendarId: 'primary',
resource: event,
conferenceDataVersion: 1,
sendUpdates: 'all', // Optional: To send updates to attendees
});
console.log('Created event response:', JSON.stringify(response.data, null, 2));
return response.data.conferenceData.entryPoints[0].uri; // Extracting the Meet link
} catch (err) {
console.error('Error creating Google Meet link:', err.response ? err.response.data : err);
throw new Error('Error creating Google Meet link');
}
} ````