Reputation: 63
I was trying to create an event with a conference meeting but when I tried with the below code I got the respective console log.
I also found some references but none of them worked.
https://issuetracker.google.com/issues/167260246
I am using React Native and I also used Google Authentication like this which is working pretty perfectly:
const configureGoogleSingin = async () => {
GoogleSignin.configure({
androidClientId:
'some-id',
scopes: ['https://www.googleapis.com/auth/calendar'],
});
};
const continueWithGoogle = async () => {
GoogleSignin.hasPlayServices()
.then(hasPlayService => {
if (hasPlayService) {
GoogleSignin.signIn()
.then(userInfo => {
// console.log(userInfo);
checkAuthenticationOnBE(userInfo.user);
})
.catch(e => {
console.log('ERROR IS: ' + JSON.stringify(e));
});
}
})
.catch(e => {
console.log('ERROR IS: ' + JSON.stringify(e));
});
};
My code is like this:
const conferenceData = {
// 'allowedConferenceSolutionTypes': ['hangoutsMeet'],
'createRequest': {
'requestId': `meet-${Math.random().toString(36).substring(7)}`,
'conferenceSolutionKey': {
'type': 'hangoutsMeet',
},
},
};
const event = {
'summary': 'ShopOnLive Meeting',
'description': "I want to buy something.",
'start': {
'dateTime': meetDateTime.toISOString(),
'timeZone': Intl.DateTimeFormat().resolvedOptions().timeZone // current timeZone
},
'end': {
'dateTime': moment(meetDateTime).add(40, 'minutes').toISOString(),
'timeZone': Intl.DateTimeFormat().resolvedOptions().timeZone // current timeZone
},
'conferenceDataVersion': 1,
'conferenceData': conferenceData,
'organizer': {
'email': '[email protected]',
},
"attendees": [
// {
// "email": shop.user.email,
// "displayName": "Store Owner",
// "organizer": false,
// "self": true,
// },
// {
// "email": userEmail,
// "displayName": "Client",
// "organizer": false,
// "self": true,
// },
],
}
console.log(event);
if(!provider_token){
showToaster("ERROR: Please Logout and Login again.");
}
let eventData = null;
await googleEventCreaterAPI(JSON.stringify(event), provider_token).then(async res=>{
console.log(res.data);
eventData = res.data;
}).catch(err=>console.log(err));
and here I have two console.log 1st console.log
{
"summary": "ShopOnLive Meeting",
"description": "I want to buy something.",
"start": {
"dateTime": "2023-04-21T14:33:00.000Z",
"timeZone": "Asia/Calcutta"
},
"end": {
"dateTime": "2023-04-21T15:13:00.000Z",
"timeZone": "Asia/Calcutta"
},
"conferenceDataVersion": 1,
"conferenceData": {
"createRequest": {
"requestId": "meet-dk8ncv",
"conferenceSolutionKey": {
"type": "hangoutsMeet"
}
}
},
"organizer": {
"email": "[email protected]"
},
"attendees": []
}
2nd console log
{
"kind": "calendar#event",
"etag": "\"3364017758736000\"",
"id": "q7blnj6j4b4rjvrfu051ssgen4",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=cTdibG5qNmo0YjRyanZyZnUwNTFzc2dlbjQgc3VtaXRAc2hvcG9ubGl2ZS5pbg",
"created": "2023-04-20T16:41:19.000Z",
"updated": "2023-04-20T16:41:19.368Z",
"summary": "ShopOnLive Meeting",
"description": "I want to buy something.",
"creator": {
"email": "[email protected]",
"self": true
},
"organizer": {
"email": "[email protected]",
"self": true
},
"start": {
"dateTime": "2023-04-21T20:03:00+05:30",
"timeZone": "Asia/Kolkata"
},
"end": {
"dateTime": "2023-04-21T20:43:00+05:30",
"timeZone": "Asia/Kolkata"
},
"iCalUID": "[email protected]",
"sequence": 0,
"reminders": {
"useDefault": true
},
"eventType": "default"
}
Upvotes: 1
Views: 771
Reputation: 2203
In order to create an event with Google Meet link, conferenceDataVersion
needs to be passed as a parameter, not as a payload. You also have to make sure that the request body has the conference data properties.
Sample Code:
const calendarId = "###";
const event = {
start: { dateTime: "2021-01-01T00:00:00.000+09:00" },
end: { dateTime: "2021-01-01T00:30:00.000+09:00" },
attendees: [{ email: "###" }],
conferenceData: {
createRequest: {
requestId: "sample123",
conferenceSolutionKey: { type: "hangoutsMeet" },
},
},
summary: "sample event with Meet link",
description: "sample description",
};
gapi.client.calendar.events
.insert({
calendarId: calendarId,
conferenceDataVersion: 1,
resource: event,
})
.then((res) => console.log(res.result));
References:
Upvotes: 1