· Documentation · 4 min read
Importing FTP feeds into Zoho CRM using Zoho Analytics
You can make use of the Export API functionality to export the data from Zoho Analytics and then import it into Zoho CRM.
Overview
There may be various types of data you want to import into Zoho CRM via FTP Feed, such as vendor product files and price updates.
This guide will walk you through a practical example that we frequently implement for our clients.
Use Case
Our client manually adds new products and price updates from their vendor into Zoho CRM, to be used in Quotes. However, since the vendor updates item prices daily, our client struggles to keep up with these manual updates, resulting in discrepancies for the sales team.
By leveraging the vendors FTP feed, we will be automating this process to import new products, price updates, availability, and more. This automation will be scheduled to run daily at 1am, ensuring the sales team begins their work with the most accurate information.
Our client can now put manual updates in the past, staying hassle-free and saving hours of labor.
Requirements
Zoho CRM, Zoho Analytics
Getting started
To integrate the FTP Feed into Zoho CRM:
-
We use Zoho Analytics to retrieve your FTP feed and store it as a table.
-
Create a Deluge function in Zoho CRM that accesses the Zoho Analytics Export API to retrieve the table data.
-
Set the Deluge function as a schedule, so we can run our automation daily, weekly, or as needed.
This process allows us to update any module within our CRM with the data in the table. It can also be used to update other Zoho applications besides CRM.
1. Retrieve your FTP feed in Zoho Analytics
Let’s start off by adding your FTP Feed into Zoho Analytics.
2. Create the Deluge Function
Let’s use the Export API to get the Vendor FTP table data. Replace the orgId, workspaceId, and viewId with your own:
orgId = "XXXXXXXX";
workspaceId = "XXXXXXXXXXXXX";
viewId = "XXXXXXXXXXXXX";
headersMap = Map();
headersMap.put("ZANALYTICS-ORGID",orgId);
config = Map();
config.put("responseFormat","csv");
paramsMap = Map();
paramsMap.put("CONFIG",config.toString());
Vendor_FTP_Feed_response = invokeurl
[
url :"https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/data"
type :GET
parameters:paramsMap
headers:headersMap
connection:"analytics_oauth_connection"
];
info Vendor_FTP_Feed_response;
Next, use the Export API to get the CRM Product data (must have CRM integrated to Analytics). Replace the orgId, workspaceId, and viewId with your own:
orgId = "XXXXXXXX";
workspaceId = "XXXXXXXXXXXXX";
viewId = "XXXXXXXXXXXXX";
headersMap = Map();
headersMap.put("ZANALYTICS-ORGID",orgId);
config = Map();
config.put("responseFormat","csv");
paramsMap = Map();
paramsMap.put("CONFIG",config.toString());
CRM_Product_Feed_response = invokeurl
[
url :"https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/data"
type :GET
parameters:paramsMap
headers:headersMap
connection:"analytics_oauth_connection"
];
info CRM_Product_Feed_response;
Then create a dictionary map storing the sku and price:
// Create a dictionary for fast lookup
vendor_ftp_feed_dict = Map();
// Populate the dictionary
for each data in Vendor_FTP_Feed_response
{
vendor_ftp_feed_dict.put(data.get("SKU"),data.get("Price"));
}
Next, we match each Vendor Feed SKU to each CRM Feed SKU. If we find a matching item SKU, let’s see if the price has changed. If the price has changed then we need to update it:
bulkRecords = List();
for each crm_product in CRM_Product_Feed_response
{
if(vendorfeed_dict.containsKey(crm_product.get("SKU")))
{
// Retrieve the value associated with the key
value_in_dict = vendorfeed_dict.get(crm_product.get("SKU"));
// Compare the retrieved value with the value in data_CRM_Products
if(value_in_dict != crm_product.get("Price"))
{
updateItem_mp = Map();
updateItem_mp.put("id",crm_product.get("Id"));
updateItem_mp.put("Price",value_in_dict);
bulkRecords.add(updateItem_mp);
}
}
}
Lastly, update each record inside of bulkRecords using Zoho CRM update API.
3. Create schedule to run the function
To create a custom schedule in Zoho CRM
- Go to Setup > Automation > Schedules.
- Click Create your First Schedule.
- In the Create New Schedule page, do the following:
- Enter a name and description to the Schedule such as “Vendor Feed Update”.
- Now choose the Function we just created to be associated with the schedule.
- Choose an Execution Start date and Execution time to which the Function should be executed.
- Set schedule frequency from the available drop-down list. You can execute the custom action either once or on a daily, weekly, monthly or yearly basis with specific date/time and recurring frequency.
- Click Save.
Final Notes
We recommend creating an additional table in Zoho Analytics to submit a log entry each time the function is ran, logging the products that were updated. So we can have a historic view of this information.
If you are a Zoho customer and need help with this integration, feel free to contact us.