api Google calendar
# 🤝help
b
Hello, I am new to botpress, I try to build a bot with API google calendar, but it look like it doesn't work. No answer in botpress when I ask informations to google calendar. How can I solve it? Do I need the auth0 configuration in google calendar API? #1116045108614287380 Thanks
f
Hey there, Could you share a bit more information about what you have been trying to do, and how you have been doing it.
l
Do I need the auth0 configuration in google calendar API? You can do OAuth or API to access google calendar. If you are using OAuth , you will need a signup process to get the token and calendar access. Additionally, you will need to setup the OAuth consent screen before you start accepting OAuth based Sign in
b
hello, thanks for your answer. i am new to coding, i mean i already work on html pages and i am able to understand coding but never code anything really. So I want a bot to talk manage my appointement on google calendar without showing my availabilities, so the bot ask the user availibilities and match with the information on the calendar, Since the moment i asked, no more problem with auth0. I cannot understand how to call from botpress the list of avaibilities of my calendar to the ai assistant of botpress. where i stop : create a node add a standar card name ''list Events" from execute, so the start from star, do you want to reserved (yes or oui in french) linked to event list here the error message : oui Captured variable oui Transitioned - Main:google_calendar_api Error Occured Transitioned - Main:explication_list_google undefined
yes i finnaly arrvied to set up auth0 in google thanks
l
Great!!!
const eventsURL = `https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events from the const first events, the rest of the calendar is free
b
hum...maybe i dont understand
l
https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events where calendarId is the id of the calendar you got access to using Auth0, will return all events in the calendar. The rest of the slots are free
b
Still don't understand the context
l
Never mind, I was referring to your above comment on "how to call from botpress the list of avaibilities of my calendar"
b
thanks, can you maybe explain me where i have to put this, or where i can go to write something ? i can t see where i s the problem
and the code you wrote, i should put it somewhere ?
l
in an execute card something like below > `async function getEventsData(searchDate) { > const eventsURL =
https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events
> console.log('Events URL ', eventsURL) > // Convert searchDate to ISO string format > const newsearchDate = new Date(searchDate) > const timeMin = new Date(newsearchDate.getTime()).toISOString() > // Calculate timeMax by adding one day to searchDate and convert it to ISO string format > const timeMax = new Date(newsearchDate.getTime() + 24 * 60 * 60 * 1000).toISOString() > console.log('In getEventsData', 'Today ', timeMin, 'Tomorrow ', timeMax) > const requestOptions = { > headers: { > Authorization:
Bearer ${access_token}
> }, > params: { > timeMin: timeMin, > timeMax: timeMax > } > } > try { > const response = await axios.get(eventsURL, requestOptions) > const events = response.data.items > return events > } catch (error) { > console.error(error) > return 'error' > } > }`
b
ok i think i understand that you can code in the botpress...
how can i see the code behind the ''list event'' card ?
i ma impress, you already gave me the code meanwhile i cant see where to put the code, lol
l
you cannot see the code behind a card apart from the code you have written in the execute card
b
ok thank you so why do they put this card ? its a nightmare for me
l
This is just one function, you will have to write a lot of code to get this working. It will be easier to connect the code with Zapier or Make
b
ok so now i have to create my own card with the code you gave me, arranged with my expectation, perfect and by the time we here is it the same process to give this information to an ia bot to formulate an answer. imagine my calendar say i am free at 14h and 15h and i want the bot to propose 14h
i understand that what i want is a lot more big than i think
and ok i ll see with zapier, i am just a bit wooried that will be more longer
thanks a lot fofr your help
l
I have my own bot building company. We can take this contract and build for you, on your Botpress account
b
how much approxi ?
l
Check DM
6 Views