Google Credentials and Syncing

This enhancement is in Beta please help by providing us your feedback! It is only available in SuiteCRM versions 7.11 and newer.

Overview

SuiteCRM has the ability to synchronize a user’s meetings with their Google Calendar. This is a bidirectional sync, and changes on either end of the synchronization cause updates on the other.

There is no middle-man in this process. Your data does not pass though any 3rd parties. It’s just your SuiteCRM instance, and Google’s servers.

Requirements

Valid API Credentials

In order to synchronize a user’s SuiteCRM meetings with their Google Calendar, the system must have valid credentials saved.

These credentials are created on the Google Developer’s Console, downloaded as a JSON file, and imported into SuiteCRM. There are instructions on how to do this further down this page.

Internet Access from the SuiteCRM Server

The SuiteCRM server must also have access to the internet. However, the SuiteCRM server does not need to be publicly accessible. The user must be able to reach both Google and SuiteCRM at the same time to authorize calendar access. Once that is done, the synchronization process runs on a schedule without any user interaction. The user does not need to be logged in to SuiteCRM for the synchronization to function.

At Least One Google Account

You’ll need a Google Account to create the API credentials, and an account to synchronize with. They can be the same account if you only have one user. The API credentials only need to be generated once, from a single account. These credentials can be used to synchronize all the users once they authorize access to their account. These accounts can be generic @gmail.com accounts, or any level of GSuite accounts (Basic/Business/Enterprise).

Generating & Installing Google Credentials

Generating Credentials

Make sure you’re logged into a Google account before proceeding.

Click on the drop-down at the top of the screen.

cred 1

Click on the 'New Project' Button.

cred 2

Give the project a descriptive name, like 'SuiteCRM Google Sync', and click 'Create'.

cred 3

At the top of the page, click on the 'Select a project' dropdown…​

cred 4

…​then click on the project you just created.

cred 5

You’ll now see the project in the dropdown, and a notice that no API’s are enabled. Click on the ‘Library’ link in the notice.

cred 6

In the search window, type in “Calendar”, then click on the ‘Google Calendar API’ result.

cred 7

Click the ‘Enable’ button.

cred 8

Now that we’ve enabled the API, we create the credentials. Click the ‘Create credentials’ button.

cred 9

Set the options in section 1 like this. Click on ‘What credentials do I need?’ to continue.

cred 10

For Section 2, give it a descriptive name. Leave ‘JavaScript origins’ blank.

Under ‘Authorized redirect URIs’, you need to fill in the full URI to the ‘saveGoogleApiKey’ Entry Point.
For example, if you reach your SuiteCRM install at the URI 'http://crm.yourdomain.com/' then you would append 'index.php?entryPoint=saveGoogleApiKey' to the end of that. The full URI would be
http://crm.yourdomain.com/index.php?entryPoint=saveGoogleApiKey
If your SuiteCRM install is under a subdirectory, you’ll need to include that. For instance
http://crm.yourdomain.com/SuiteCRM/index.php?entryPoint=saveGoogleApiKey

Note that this does not need to be a public URL. It only needs to be accessible to the user who is enabling the calendar sync. It is strongly recommend having an https enabled site for production on a publicly accessible site.

Then click on ‘Create OAuth client ID’.

cred 11

Again, create a descriptive name. There are more options under ‘More customization options’, but they are unnecessary for this to function. Then click ‘Continue’.

cred 12

Click on the ‘Download’ button. Save the .json file. We use this later in SuiteCRM. Click ‘Done’ when finished. This is all we need for all our users to be able to sync their calendars.

cred 13

Installing Credentials

Log into SuiteCRM as the administrative user.

Go to ‘Administration’.
Then scroll down to the 'Google Suite' section.
Click on the 'Google Calendar Settings' item.

Note how it says 'Unconfigured'. This means there is no JSON file currently installed.
Click on the 'Choose File' button here, and select the JSON file you downloaded from the Developer’s Console.
Click the ‘Save’ button at the bottom of the screen.

cred 14

This will return you to the 'Administration' menu. Go back into 'Google Calendar Settings'.
Now it says 'Configured' in green to show that the JSON file has been successfuly saved.

cred 15

If you ever need to install new credentials, simply upload them. They will overwrite the old ones.

Authorizing Calendar Access

This needs to be performed by the User to enable syncing with their Google Calendar

Click on your name dropdown in the upper right of the SuiteCRM site, then on ‘Profile’.

cred 16

Go to the ‘Advanced’ tab.

cred 17

You should see the ‘Google Account Synchronization’ Subheading at the bottom. If it’s not shown, then the SuiteCRM server doesn’t have Google Credentials installed.
Click on the ‘Authorize’ button.

cred 18

If you are logged into multiple Google accounts, you’ll be asked which Google account you want to sync with. Otherwise, you’ll be taken directly to this dialog:

cred 19

Once you click on ‘Allow’, you’ll be taken back to the user profile page. Click on the ‘Advanced’ tab again, and you should see:

cred 20

Check the ‘Enable Calendar Sync’ checkbox, and then click the ‘Save’ button.

That’s it! By default, the sync happens every quarter hour. That can be changed by the Administrator in the Scheduler configuration.

Known Issues

If the value of "google_calendar_sync_name" is changed then this will cause ALL Meetings to re-sync. This is due to the fact that if the value changes then Google detects all current meetings as new, unique Calendar items.

The best way to avoid this from happening is to not edit/change the "google_calendar_sync_name" that is located in your config.php file.

Content is available under GNU Free Documentation License 1.3 or later unless otherwise noted.