How to Integrate Drupal with Nimble CRM for Better Automation

19 Feb 2015
Alt tag.Drupal integration with Nimble CRM by Lemberg blog

The Nimble CRM

There are a great deal of CRMs (customer relationship management) out there, and Nimble stands out among them. Not only because we at Lemberg are using it for customer relationship management, but also because it’s social­based, and as the guys at Nimble put it themselves:

“Nimble has re­imagined customer relationship management by pioneering the world's first Intelligent Relationship platform. It auto­magically pulls contact profiles, email conversations and social signals into one simple place so you can effectively engage them everywhere you work.”

www.nimble.com

Nimble integrates with all the major social networks, pulling email, Facebook, LinkedIn, Google+, Foursquare and Twitter conversations and profiles into one portal. Which means you don’t have to track your leads across different social networks to see what they are up to, but open their profile in Nimble to see all their social feeds, contact details, current and past deals, emails, and even your Google documents related to this client.

 Facebook, LinkedIn, Google+, Foursquare and Twitter | Lemberg Solutions blog

How we came up with the module idea

We really love everything that Nimble offers, but felt there was something amiss and that there may be a way to tie our business even closer with our CRM of choice, to do more with Nimble. On our website, there are several forms through which we interact with potential customers:

We use Webform module for all these forms. All form submissions are stored on the website. As a request comes in, some time is spent on adding new contacts manually into the Nimble CRM. Why not automate this process by writing a module that will forever do away for good with adding contacts manually to the system after each request. 

Nimble CRM module

You can clone project from Drupal.org and install it just like any other Drupal module. The Nimble platform offers access to the stored data via APIs. Currently, key contact data is accessible via our REST API. For the module to work, you need to install OAuth2 Client module and get Nimble API Access.

1. For API Access, please email api-support@nimble.com and include the following:

  • App Name: Contact exporting tool for [your site name]
  • App Description: Creates contact on Nimble CRM account when contact form is submitted.
  • Redirect URL for oAuth callback: [your site full path]/nimble-crm/authorized

2. After you get the Client ID and Client Secret keys, enter them on the configuration page. You will be redirected to the Nimble login page. Log in to your account and confirm API access to this app. After that, you will be redirected back to your site.

: Nimble CRM configuration page | Lemberg Solutions blog

Nimble CRM configuration page

Nimble CRM Sign In | Lemberg Solutions blog

Nimble CRM Sign In

 3. Now, your can enable Nimble integration with a contact form or any other webform on your website.

Integration with core Contact Form module | Lemberg Solutions blog

Integration with core Contact Form module

Integration with Webform module | Lemberg Solutions blog

Integration with Webform module

 If you use webform, don’t forget to map your components with Nimble fields | Lemberg Solutions blog

If you use webform, don’t forget to map your components with Nimble fields.

The module itself actually consists of three sub-modules:

  • nimble_crm - Core module. Provides API requests to the Nimble CRM.
  • nimble_crm_webform - Provides Contact module integration with Nimble CRM
  • nimble_crm_contact - Provides Webform integration with Nimble CRM

Our module has the following features:

  • You can set tags that will be added to the new contact
  • You can set default values for custom Nimble CRM fields
  • Supports multiple webforms
  • You can log API requests with watchdog

Challenges

OAuth Authorization

The biggest challenge in writing the module was to establish the correct OAuth2 authorization. OAuth2 Client module facilitated our work, but we had to override the getToken() method in accordance with the Nimble API. We needed to pass access token in HTTP header Authorization in format: Bearer <access token>.

OAuth2\Client::getToken() ... 'Authorization' =>; 'Basic ' . base64_encode("$client_id:$client_secret"), OAuth2\NimbleClient::getToken() ... 'Authorization' =>; 'Bearer ' . $token['access_token'],

Access token is valid for an hour. But along with that token we get the Refresh token. When we make request more than once an hour we pass the Refresh token and get a new Access token. At first we thought to update the access token hourly via cron. But then asked Nimble API how long the refresh token is valid, and the answer was it is valid for one year. So if at least once a year someone uses your form, everything should work just fine (in case of emergency, you can send yourself a request through the form to keep the service running). Otherwise, you can simply go to the settings page and update the token manually.

Contact Duplication

There are cases when one person repeatedly fills out a contact form (could be spam bots). We decided to avoid duplication of a contact in the system. Before we add a new contact to the system, we search by the entered phone number or by email. If there is no contact with the same data in our system, a new contact is created.

One small step for Nimble, one huge leap towards CRM process improvement

With this small but useful module we want to make our contribution to the mission of Drupal integration with third party systems and devices. Our future plans are to maintain and improve the existing functionality and release a version for Drupal 8. Sign up to our newsletter to be the first to find out about module updates. 

Because we love our customers, and want to interact with them even closer through Nimble. We want all their contacts to be automatically stored in our CRM after they send in a request.

Because we are excited at the idea of creating Drupal modules to integrate the different tools that we use with our website.

And most of all, because we love to share our creations with everyone, so that the module that is helping our business can work wonders for others as well!

SEE ALSO: