MuleSoft + Shopify

Author: Eswara Pendli 

Traditional Marketing gets your local not global. 

People spend most of their time on the internet to gain knowledge/information. 

Most of them prefer to shop everything online. Moreover, the business should be online to attract a large customer base.

And it is best to have an Online Store! 

Do you know 25% of the total world population shop online! The percentage of eCommerce retail sales is nearly 19.6*% of the total worldwide. According to Statista, this can go up to 25*% by 2025.

Source: Statista: eCommerce-share-of-retail-sales-worldwide

MuleSoft released Shopify Connector in Anypoint Exchange. This connector supports the Mule 4.X Runtime version. 

In this blog, we’ll discuss Shopify, and we will establish the connectivity between Shopify and MuleSoft by using MuleSoft’s Shopify Connector.

What is Shopify: 

It is an all-in-one eCommerce platform. In simple,

  • It is a cloud-based software.
  • It is a packaged shopping cart solution.
  • It allows businesses to set up an online store with no hassle.
  • It has multiple pricing plans to choose which makes it the most suitable option of all.
  • It has most of the easy-to-use features.
Why Shopify:
  • Shopify is simple to use. 
  • We can sell most of the items like Products, Orders, Gift Cards, and more.
  • Shopify offers monthly subscriptions to their users with access to an admin portal.
  • Where this can help users to enter store info, add their products, and even process orders.
  • We can set up and run our online store in clicks away.
  • We can customize the online store dashboard with the desired theme to fit our brand.
  • Shopify is completely secure. And it is a reliable web hosting option for our website.
  • Have peace of mind and forget about the site crashing during peak traffic.

How to hook up Shopify – MuleSoft:

Setup Shopify Account:
  1. We can easily signup for a Shopify 14 Day trial account using our email address here. And create a new Shopify ID. 
  1. Once we are done with the basic setup. An Admin portal will look like this:
  1. Now go to Apps; Select ‘Develop Apps’ to create a new app to interact with MuleSoft.
  1. Provide a new app name and click on ‘Create App’.
  1. Once the app is created. Now it is time to Configure Admin API Scopes.
  1. Select and Assign required Admin API access scopes. (For the demo, we have assigned all the scopes to the newly created ‘ForDemo’ App).
  1. And choose the relevant Event Version for Webhook Subscription and save the changes. (MuleSoft Shopify 1.1.2 Connector uses ‘2021-07*’ Admin API version).
  1. Now go to ‘API Credentials’ and Click on ‘Install App’ to install the app to generate Access Token for the ‘ForDemo’ App.
  1. We can see the Admin API Access Token & API Key values, Once the ‘ForDemo’ App is installed. We will be using these credentials as username & password to establish the (Basic Auth Connection Provider) connectivity from MuleSoft.
Configuration / Connection Establishment for MuleSoft:
  1. Now, Go to MuleSoft’s Anypoint Studio and create a new Mule project.
  2. Upon creation of a new project, we can add the Shopify Connector / Module using MuleSoft Exchange. Select and add the Shopify Connector and click finish.
  1. Once the Connector is downloaded, it’s time to configure the Shopify global configuration. We will establish the connection using ‘Basic Auth connection Provider’ by providing the respective parameters,
    1. We will use API Key as username and Admin API Access Token as password.
    2. We will use Our Store URL as Base URI.
    3. Here is the configuration on the same:
      1. Base URI: https://muledemo.myshopify.com 
      2. Username: {API Key} 
      3. Password: {Admin API Access Token}
Please refer the following configuration XML for the same:
<shopify:config name=“Shopify_Connector_Config” doc:name=“Shopify Connector Config” doc:id=“82023c1f-a6c8-4076-8ae8-cf63b77e2d36” > <shopify:basic-auth-connection username=“3xxxxxxxxxxxxxxxxxxxxxxxxxxxxx” password=“shpat_xxxxxxxxxxxxxxxxxxxxxxx” baseUri=“https://muledemo.myshopify.com” protocol=“HTTPS”> <tls:context > <tls:trust-store insecure=“true” /> </tls:context> </shopify:basic-auth-connection> </shopify:config>
  1. That’s it. We have successfully established the connectivity between Shopify and MuleSoft.
  2. Now, we will see the simple demo to sync the Customer / Contact information from Shopify to External System (We are using Salesforce for the demo).
  3. MuleSoft’s Shopify connector does provide ‘On new Customer Trigger’ operation. This operation helps to retrieve the information about the Customer created at Shopify based on a scheduling strategy.
  1. Setup the new Customer information here at Shopify by selecting ‘Add Customer’.
  1. Enter your customer details as shown below (Providing test data for the demo*) and click on ‘Save’:
  1. Once the customer information is saved. An Event will be received at MulSoft (As per the ‘On new Customer Trigger Configuration*’).
  1. Upon successful process at MuleSoft. A new contact will be created at Salesforce as per the Contact object and will be shown as below:

### Shopify helps to set up an online store with more beautiful themes and at a low start-up cost! ###

         !!!!! Happy Learning!!!!!

References:

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.