I’m trying to create a event using google calendar api, but when I create it passing
conferenceData: {
createRequest: {
conferenceSolutionKey: {
type: 'hangoutsMeet'
},
requestId: 'coding-calendar-demo'
}
}
the event is created but it has no google meet link
I’m using service account for the credentials
I’m also using node.js
Here is my full code:
const {google} = require('googleapis');
const calendar = google.calendar('v3');
const {GoogleAuth} = require('google-auth-library');
const auth = new GoogleAuth({
keyFile: './meet-api-431818-d4ef4d9b2e75.json',
scopes: ['https://www.googleapis.com/auth/calendar']
});
function generateRandomString(length) {
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
const charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
async function createEvent() {
const authClient = await auth.getClient();
const event = {
summary: 'Google I/O 2021',
location: 'puta q pariu 1234',
description: 'vai porra',
start: {
dateTime: '2024-08-12T09:00:00-07:00',
timeZone: 'America/Los_Angeles',
},
end: {
dateTime: "2024-08-12T17:00:00-07:00",
timeZone: "America/Los_Angeles",
},
conferenceData: {
createRequest: {
requestId: generateRandomString(16),
conferenceSolutionKey: {
type: "hangoutsMeet",
},
},
},
};
try {
const responsePromise = calendar.events.insert({
auth: authClient,
calendarId: 'primary',
resource: event,
conferenceDataVersion: 1,
maxAttendees: 100,
});
const response = await responsePromise;
console.log('Event created: %s', response.data.htmlLink);
} catch (error) {
console.error('Error creating event:', error);
}
}
createEvent();
I tried a lot of ways to make the event, none of them created a event with a google meet link
When I use the API test in the google workspace it runs perfectly, the event is created with a google meet link, but when I try the same thing using node it doesn’t work.