I’m fairly new to coding and corvid and javascript but I’m trying to use to Google Calendar API to insert an event from my site to my calendar. I’m trying to read all the info I want to insert in the event from a container on a dynamic page which shows data from a dataset. I’ve tried to google a solution for this problem and went through the google provided documentation, but I’m not getting any results.
Problem: I need to use OAuth 2.0 to be able to connect to my calendar, but can’t make it work with javascript.
Does anyone here have the same problem and/or solution for it?
Hannu, how brave of you. Are you using Google´s API directly? Are you aware that there are 2 other possibilities: the google calendar (light) NPM and using Zapier (which is the one I used). For that, you need to create a free Zapier account, define a Zapier Webhook as a trigger and use the URL-endpoint they give you to send data to it using wix-fetch (post) from the backend.
Well I’m feeling less and less brave all the time. I think I should use the Zapier also, what Zap exactly are you using for this? All I could find was the Wix Answers to calendar events and the google sheets to calendar zaps, but I’m not sure which one to use yet.
Ooooh! Thank you Giri, this one seems to be working. Except that the sample data does not get through to Zapier, altough it sends an email from wix to my gmail. Gonna retest this and eventually succeed anyhow.
Hi Giri! I got it working allright, but I was wondering if it is possible to make it work with a custom form that gets its data from a database/collection? Currently not able to make it work
Hannu, good to hear it worked for you. First version write-ups usually lack in some places, but I am glad you got it working.
About your question: do you mean that you simply want to save the event data first and then write it also to gCalendar, or (because you wrote “gets its data …”) as a delayed action, like a scheduled (cron) job?
What I mean is that I have a custom form in a repeater that shows data from a database. I have a user input form on another page, where my customers input data. I then need to add couple of input fields for my own use and which I need to see in the calendar event.
What I’m asking is that I got it working with a Wix Form, but not with a custom form that displays data from a collection, so is it possible to make it work with a custom form?
Same question to you Yisrael: is it possible to make your example work so that the form where you have the input fields, would get some data from a database and a few blank fields where the site admin would fill in the needed data and after that send it to google sheets? Haven’t tried it yet myself so no need to stress over it, just wondering.
It’s a difficult example to modify as a beginner so I guess I’ll try other resources first.
Yes, should be do-able. The most obvious scenario would be:
you collect all the info you need from different sources (forms and your data)
you store all that together in an “events”-collection using dataset´s .save() method
.save() returns a Promise, holding all the values for the row you just stored in JSON-format
now you map those fields (using dot-notation) onto the JSON-object that sends info to Zapier
or, instead of 3, you don´t wait for the Promise to return and just prepare the JSON-object from the input you gathered in 1 (they shoulld be 100% identical).
EDIT: What I do not understand is this: do you mean a user fills out a form on your site and YOU want to add info to this MANUALLY? If so, you have to split it up into parts:
let user fill out form
store it in a collection
send an email to yourself “You have work to do” with a link to another form on your site (Admin)
click on the link in email, show another form with the extra fields, fill it out
Your google sheets NPM example is excellent, however it proving very difficult for a beginner coder to adapt it to other APIs due to its complexity.
It would be great to see a similar example for connecting to the Google calendar API - e.g how to set up OAuth 2.0 with some examples for using the API in Corvid and with the Wix DB.
re you using Google´s API directly? Are you aware that there are 2 other possibilities: the google calendar (light) NPM and using Zapier (which is the one I used). For that, you need to create a free Zapier account, define a Zapier Webhook as a trigger and use the URL-endpoint they give you to send data to it using wix-fetch (post) from the backend.
Thanks Yisrael. This link is now broken. Is there a new link you can share?
I am looking to make a list of non-repeating events in text form from google calendar api. Does my api key get stored in frontend, or does wix make the request and rebuild my site every time something changes on the api’s side? I know JavaScript and html, but haven’t used wix before; just trying to help a friend with their site.
Thanks Shan. This link is now broken. Is there a new link you can share?
I am looking to make a list of non-repeating events in text form from google calendar api. Does my api key get stored in frontend, or does wix make the request and rebuild my site every time something changes on the api’s side? I know JavaScript and html, but haven’t used wix before; just trying to help a friend with their site.