Salesforce-Shopify Integration

Client

Client is a UK based design and production service company. They are known for creating fonts with a distinctively human character. They provide a strong library of fonts and also provide a service centred around good design.

Challenges

  1. The requirement was to integrate the Shopify store of client to their Salesforce instance. Client wanted to store the purchase information like name, company, email, phone number, address etc from Shopify into Salesforce and create a closed Opportunity for the sale with product and price information. Client also wanted us to check for duplicate records before creating them in Salesforce and check if Accounts and Contacts are to be created or not.
  2. There was also a requirement to upload previous years Sales data into Salesforce.
  3. The inserted Contacts were also synched with mailChimp to send regular emails to the appropriate customers of the client.

Solution

As per our analysis of the given requirements, we created an Apex batch class to fetch the data from Shopify API and insert them in Salesforce org. This Apex batch was designed to get only recently created/updated orders from Shopify API. We scheduled this batch to run as per client requirement.
Shopify API is REST based API. We received the callout response in JSON format. From the received response, we mapped the required fields in different objects to create records in their respective objects in Salesforce.

Result

As per client’s requirements, we inserted two types of Account records in Salesforce instance based on returned JSON response.
  • Business Account (Standard Account).
  • Person Account.
If ‘Billing Company’ was null or blank in API response then we inserted a ‘Person Account’ otherwise we inserted a ‘Business Account’.

To add Contacts’ emails who opted for email marketing, we fetched these Salesforce records using SOQL. After that we scheduled the MailChimp job to run once in a day to sync the Contacts’ email with MailChimp.