New extension to sync Civi Groups with Google Groups

Publié
2015-07-01 09:13
Written by
awestbha - member of the CiviCRM community - view blog guidelines

At the BHA we use a lot of Google Group mailing lists, and of course we manage all our contacts through Civi. This meant plenty of duplication - when the head of a particular section changed, say, we'd have to update it in Civi and then the Google Group. So we asked Veda Consulting to write us an extension that automatically synced the two. The first version is now out and available here:

https://civicrm.org/extensions/google-groups-civicrm-integration

Features

  • Syncs the contacts from multiple Civi groups (regular or smart) to specified Google Groups
  • Adds a scheduled job to automatically sync once per day
  • Adds contacts to the Google Groups silently - people don't get authorisation requests
  • Supports multiple domains within a Google Apps system

Setup

You will need a Google Apps for Business / Education / Non-Profit account (the API access isn't allowed with the old free accounts, unfortunately).

In order to grant Civi API access to your groups, you first need to create a project at https://console.developers.google.com/project. Then in 'APIs and auth' -> Credentials, create a new Client ID for 'web application'. It'll create an ID and a secret for you. You'll need to add a Redirect URI of http://<<your domain>>/civicrm/googlegroup/settings?reset=1 (adapted appropriately for your CMS, if necessary).

Install the extension and enter the client ID, the client secret and the domains you want it to use. It'll then go off to Google to authorise itself (this is where the redirect URI is important).

Once that completes, you're all set! To configure the sync, go into Manage Groups and click 'Settings' next to the group you want to sync. You can then choose the appropriate Google Group. Then go to Mailings -> Sync Civi Contacts to Googlegroup to manually run a sync (bear in mind it will overwrite the contents of the Google group with those of the Civi group - see below).

Things to note

  • The sync is one way: from Civi to Google Groups. This is because, for our use-case, Civi is our primary source for all contact information and all mailing lists should always match it. So you can't add someone to a Google Group and have them land in Civi - if you manually add someone to the Google Group, they'll get removed in the next sync.
  • By default the sync won't include people who are marked as Do Not Email, On Hold, or No Bulk Emails. I think this is best for a public extension, but if you want to remove any of these criteria (we removed No Bulk Emails), go to Form/Sync.php and search for $contact->is_opt_out - then remove it from the if statement.
  • This is the first release, so please do report any bugs.

This is saving us a lot of time - hopefully it'll be useful for others too.

Filed under

Comments

Anonymous (non vérifié)
2015-12-28 - 22:18

That does not appear to be the correct Redirect URI. Google is reporting, "The redirect URI in the request: <Request URI> did not match a registered redirect URI." The URI Google mentions is substantially different than the example given above.

Git Issue Queue

Could you raise any specific issue on the github issue queue please https://github.com/veda-consulting/uk.co.vedaconsulting.googlegroup/issues

Anonymous (non vérifié)
2016-01-24 - 07:29

A word of caution for those thinking about implementing this suggested extension: We could not get it to work as noted in our prior comment and Veda Consulting did not respond to their support email. This is disappointing because it seems like something our organization could really benefit from.