Extension Pointers #2: Fetching contacts from Google into Zoho CRM

Extension Pointers #2: Fetching contacts from Google into Zoho CRM

Contact management is a key feature for handling your customer relationships effectively. The process of gathering as many contacts as possible can give you an upper hand to create more leads in your Zoho CRM account. In our previous post, we provided a detailed guide on how to create a connector and push a contact from Zoho CRM to Google using the POST Connector API. The contacts stored in your Google account can serve as a major source of potential leads for your business. That's why, in this post, we want to show you how to fetch the contacts from Google into your Zoho CRM account using connectors.

We'll also be giving a pointer on an option you have when implementing this functionality. Retrieving contacts helps with customer relationship management by increasing the chances of converting them into potential leads. For a detailed guide on creating a connector please refer here.



The figure above represents the flow of data during the process of getting contacts from Google Contacts. This includes the following actions:

➤ Zoho CRM makes an Http request to Google Contacts through the Connecter API
➤ Http response is received in JSON format from Google
➤ Based on your requirements, a DELUGE script is written to extract the required data
➤ Zoho CRM API is invoked, pushing the data into the Contacts module

Creating the GET Connector API:

1. Create a Connector API with 'GET' as the method type to fetch the contacts from Google Contacts into your Zoho CRM application.

Name of Connector API
GetContacts
Method Type
GET
URL

Note: The alt query parameter in the URL indicates the type of feed to return. In our example, json is the expected feed return type, whereas atom is the default return type.

2. Execute the API to check if the response is successful.


3. After execution, Publish the API and add it under the Associated Connectors tab to associate it with the extension.




Creating "Get Contacts from Google" button to fetch the contacts from Google into CRM

1. Choose the Components section on the left panel of the developer console. Select the Links & Buttons tab and click Create New Button.
2. Choose the Contacts tab, name the button, and choose the place where the button needs to be located. Select Writing Function as the action that will be performed by the button.
3. Associate the button "Get Contacts from Google" with the function "getcontactsfromgoogle". 



4. The Http response obtained from Google in the JSON format is handled using the "getcontactsfromgoogle" function. It extracts the Phone Number, Email, Title, First Name, and Last Nameof the contacts. The "crm.create" CRM API is invoked, adding the data to the client application.



getcontactsfromgoogle function code snippet

dynamic_map = Map();
data=List();
resp=zoho.crm.invokeConnector("crmsyncgoogle.googlesync.getcontacts",dynamic_map); 
response = resp.get("response"); 
feed = response.get("feed");
info feed;
entry = feed.get("entry");
for each value in entry

record = Map(); 
Phone = value.get("gd$phoneNumber"); 
for each val in Phone

Ph = val.get("$t"); 
record.put("Phone",Ph);

Email= value.get("gd$email"); 
for each val in Email

Em = val.get("address"); 
record.put("Email",Em); 

Organization= value.get("gd$orgTitle"); 
for each val in Organization 

Org= val.get("gd$orgTitle"); 
title= Org.get("$t"); 
record.put("Title",title); 

Fullname= value.get("title"); 
name=Fullname.get("$t"); 
record.put("Last_Name",name); 
record.put("Lead_Source","Google"); 
data.add(record);

m=Map(); 
m.put("module","Leads"); 
m.put("data",data); 
response = zoho.crm.invokeConnector("crm.create",m); 
info data; 
return "Contacts Fetched"; 


5. Click Test your Extension to test this functionality in an isolated sandbox testing environment to check if the contacts are being retrieved from Google to Zoho CRM.

Google Contacts


Click the Get Contacts from Google button and check if the contacts from Google Contacts are fetched into your Zoho CRM Contacts module.




The contacts are fetched into Zoho CRM from Google


Pointer to explore:

➤ As an alternative to associating a function to a button, you can also use Schedules to further automate and simplify the process of fetching contacts from Google. Creating a schedule can help keep your contacts automatically updated in your Zoho CRM account based on the scheduled time intervals.

Createa new schedule and associate the getcontactsfromgoogle function to the Schedule.


Set customized time intervals for the schedule to trigger as needed.



We hope you found this helpful. Keep following this space for more info!

SEE ALSO



                                                                                                                                               
           

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now