GCalendar Integration

[TOC] OS Services Booking has the option to allow you to integration your Booking system with Google Calendar. It works like this way: When customer makes the booking request with one Employee in your OSB system. The appointment will be added to Gcalendar of that employee, and if that booking request is cancelled or removed by administrator or customer, the appointment on Employee’s Gcalendar will be removed.

OS Services Booking won’t (cannot) check the available time on Employee’s Gcalendar before adding appointment into Gcalendar.

To user Google Calendar, you need to have:

  1. A Google Account for creating and using Google Calendars
  2. PHP 5.4 or higher.
  3. Google Data PHP Client Library V3 (included in OS Services Booking package) and extract it into directory: root => components => com_osservicesbooking
  4. OS Services Booking 2.3.x or greater

From November 17, 2014, Google shut down their Calendar API v1. You now require OS Services Booking 3.3.3, or higher, to talk to Google Calendar. And Google only allows connection via their version 3 API. This requires you to create a Google App and give it access to your calendar(s). The App is how OS Services Booking is now able to add/remove bookings as calendar events.

Three Steps to adding OS Services Booking access to your Google Calendar.

  • Create an App in Google
  • Install the Google library and key file in you OS Services Booking directory
  • Setup to connect OS Services Booking with GCalendar

Create an Google App

Login to Google and go to the Developer's Console..
https://console.developers.google.com/project
Click on 'Create Project'

Enter a name (can be anything you like, here I used OS Services Booking)

Enable Calendar API, Service Account and get P12 key
If your Google account is G-Suite, you can register the Internal OAuth consent, while if your Google account isn't G-Suite, you just can register External OAuth constent and more complex. Below pictures are Internal consent registration
You need to register OAuth Consent before you can create OAuth Client ID for Web application

The CLIENT ID and EMAIL ADDRESS fields will be needed when you setup an OS Services Booking resource to write to a Google Calendar. Click on Generate new P12 key. Save the generated key on your local PC for later upload to your web site.

Install the Google library and key file

You will need to download the Google PHP Client Library from http://osb.ext4joomla.com/google-api-php-client-master.zip
On the right of the screen is a 'Download ZIP' button.
Unzip and upload the google-api-php-client-master folder to the OS Services Booking directory in your web server..
Also, upload the .p12 key file that was generated in the steps above to the com_osservicesbooking folder.

Setup “Gcalendar Integration” feature on OSB

Go to Configuration => Tab Booking Configuration and Select Yes at the dropdown select list
After above step, you need to enter the Employee’s Google account and Gcalendar ID. To implement this step, please go to Employee modification page.

Client ID, App Name, App Email Address are all obtained from the Google App Credentials screen above. To get the Calendar ID, open the Calendar settings screen in Google. In the Calendar Settings screen near the bottom you will see the Calendar Address section and on the right the Calendar ID.

Finally you will need to set your calendar as shared with the Google App's email address from above. Enter the Service Account and select permission: Make changes to events

If the option "Make changes to events" is blocked, you need to do below steps to un-block it.

  1. Open this page: https://admin.google.com/ac/appslist/core
  2. Select Application Calendar
  3. Open category: Sharing Setting -> External sharing options for primary calendars, please select option: "Share all information, and allow managing of calendars"
  4. Re-assign Service account to the GCalendar with permission Make changes to events

Now new bookings for this resource will be added to your Google Calendar. As with all 3rd party calendars the communication is one-way only. Changes made in your Google Calendar will have no effect on OS Services Booking.
If all above works are done. You have completed configuration the “Gcalendar Integration”, from now, when customer make the booking request on your employee, his(her) Gcalendar will be updated the appointment.