Google Calendar Integration

System Information
  • 3.5.3:
  • MacOs Big Sur:
  • MongoDb:
  • v12.20.1:
  • 1.22.10:

Dear all,

Currently I am building a react new app which is using a React.js front-end.
In the React front-end app there is the ability to plan in an appointment.

These appointments should be added to a Strapi collection type called “Appointments”. This works as expected with the build in tools from Strapi.

However, besides that it creates a collection type, it should also create a new event in the Google-Calendar of the Strapi admin. (main account)

What is the best way to enable creation of Google Calendar events with the official google-api from the back-end in Strapi when a collection type “appointment” is created?

1 Like

If I was you, I will create a custom plugin ( Calendar sync ) where you can add deferent calendar connections similar to providers in Settings.where you add google with a pen icon you click on it to add authentication config

In the plugin controllers you create functions ( add/cancel/edit event on calendar ) where you loop throw the calendar providers and execute the api requests ( Google api endpoints)

and then you call this controllers in the appointments create controllers/services depending on your need

P.S: It seems interesting what you creating , are you creating booking system using Strapi as BE and reactJs FE, I am planning to do something similar soon

2 Likes

Hey Nebras,

Thanks for your reply. I was already creating the plugin indeed!
I am creating a booking system for a car garage.

However I can’t get past the step to exchange the client + secret for a google oauth access token to actually make the requests…

Any idea how I could manage to do that from the strapi plugin?

it depends what Authentication way you are using for google API ?

It needs to be authorized via oauth.

I tried to use the passportJs middleware. But don’t get to the login screen of google.

I would suggest to you to use service account credentials, it is much more efficient to authnticate between BE and google API, specially as it is not deferent accounts( users ) what you need to authenticate to

you can follow this processes

https://isd-soft.com/tech_blog/accessing-google-apis-using-service-account-node-js/

is it private project what you are working on ? I will be interested to know more about the project if it is a possibility

thanks

1 Like

Do you have discord or anything similar? We can connect there and you might can help me with building out the pieces.

Currently I am struggling getting the password run as route middleware in strapi.

In express you would do something like this:

app.use(route.post('/login',
  passport.authenticate('local', {
    successRedirect: '/app',
    failureRedirect: '/'
  })
))

my discord is: othmaneb

I am not sure why you want to use passport here, do you want the admin user to login into admin using google ?

1 Like

What is your tag code in discord?
No I need the logged in strapi user to connect to it’s google calendar, so I can obtain a access token to send api request with.

Did you ever manage to build this plugin?

I definitely did! Do you need help?

I’m about to embark on building something very similar. Any chance of you selling this plugin to me? would save me a boatload of time.

1 Like

Let’s connect via PM. I am open for a chat. :+1:t3:

I am not seeing a way to PM you directly through this site??? What would be the best way for me to send you a PM?

Oh, it looks like that functionality is limited for me as I am a new user. Could you send me a PM?

I just sent you an PM.

hey can we connect? im making something like this and your plugin looks to be the savior :slight_smile: PM me please, best

Hey sure thing! Just sent me a message and I’ll reply.
What can I help you with

Kevin

Can I also chat with you about this calendar sync plugin?

Thanks,

Matthew

Yeah sure! Go ahead and ask away. :wink: