Close Menu
SalesforceCodex
    Facebook X (Twitter) Instagram
    Trending
    • Top 10 Salesforce Flow Features of Salesforce Summer ’25
    • Unlock the Power of Vibe Coding in Salesforce
    • How to Implement Dynamic Queueable Chaining in Salesforce Apex
    • How to Implement Basic Queueable Chaining in Salesforce Apex
    • How to Suppress PMD Warnings in Salesforce Apex
    • Top 10 PMD Issues Salesforce Developers Should Focus on in Apex
    • How to Use Graph API for Outlook-Salesforce Connection
    • Enhancing Performance with File Compression in Apex
    Facebook X (Twitter) Instagram
    SalesforceCodex
    Subscribe
    Tuesday, May 20
    • Home
    • Architecture
    • Salesforce
      • News
      • Apex
      • Integration
      • Books Testimonial
    • Questions
    • Certification
      • How to Prepare for Salesforce Integration Architect Exam
      • Certification Coupons
    • Integration Posts
    • Downloads
    • About Us
      • Privacy Policy
    SalesforceCodex
    Home»Salesforce»Apex»Shopify integration with Salesforce using Webhook

    Shopify integration with Salesforce using Webhook

    Dhanik Lal SahniBy Dhanik Lal SahniMarch 15, 2023Updated:January 13, 20259 Comments5 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email
    Shopify integration with Salesforce
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Many times, we need to integrate external systems to pull information about the created customer or their transaction details. On data retrieval, we create a similar record in Salesforce so that both systems are in sync. This can be achieved using both pull and push technology. In pull technology, we can create batch jobs to pull external system information and it will run at a set interval of time. With push technology, an external system can push information to salesforce when a certain event is created in their system. We can use Salesforce Webhook/Platform Event/API for pushing information to Salesforce. We will use Salesforce Webhook to sync both Salesforce and the external system. In this post, we will do Shopify integration with Salesforce using Webhook to sync shopify customer data. We can utilize the same concept with other external system integration which supports webhook notification.

    A webhook is an HTTP-based callback function that allows lightweight, event-driven communication between 2 application programming interfaces.

    Using pull technology we have a problem, it will sync data only when the job will run so it will not be real-time data sync. In push technology, data will be synced as soon as an event is raised.

    Use Case for this post

    We have an e-commerce platform that is using Shopify for its day-to-day operation. Customer, order, refund everything is saved in Shopify. Business wanted to sync complete data in Salesforce. For this post, we will create customers as soon as customers are created in Shopify. For other data, a similar process can be implemented.

    Solution Implementation

    Let us use Salesforce Webhook to sync data between Shopify and Salesforce. To implement a complete solution we will do the below tasks.

    1. Create Apex REST API
    2. Make Apex REST API publicly accessible
    3. Setup Webhook in Shopify
    4. Test Implementation

    1. Create Apex REST API

    As we have to sync data between Salesforce and Shopify, we will create a REST API that will create customers in Salesforce. This API will be configured in Shopify Webhooks. To create API we need a sample request JSON that will be sent by Shopify on customer creation. You can take sample request JSON from here.

    Let us create an Apex serialization class for the above sample request JSON.

    Let us create Apex REST API that will create customers in Salesforce. This REST API will consume the above apex wrapper class to get Shopify record data.

    For this post, I have used only standard fields for account record creation. You can add other fields based on your requirement.

    ApplicationException is a common exception class to log issues in a custom object. You can check our post Exception Logging in Custom Object : Salesforce Apex for complete detail about exception logging.

    2. Make Apex REST API publicly accessible

    We have apex REST API now and we can consume it with proper authentication. To use as Salesforce Webhook, this API should be publicly accessible. To make it publicly accessible, we can create a Salesforce site using Setup->Sites.

    Create a site shopifywebhook and set detail like the below image.

    Shopify integration with Salesforce - SalesforceCodex
    Once the site is created, open it and click the button Public Access Setting to configure Apex classes.
    Public Access Sites in Salesforce - SalesforceCodex

    When we click Public Access Setting, it will open a guest profile for the site. Select all apex classes in the section Enabled Apex Class Access that needs to run when API will be accessed by Shopify webhook. Provide object access as well for the objects, for this post we need to give read/create access for Account object.

    After the above configuration apex REST API will be publically accessible.

    Note:

    For security reasons, you can check Shopify headers to verify that webhooks request is sent by the correct Shopify store. You can check the below headers for verification.

    X-Shopify-Topic: customer/create
    X-Shopify-Hmac-Sha256: XD5454y6OsLMeiZKwP4FppHH454534535eH5Jo4bM= (sample)
    X-Shopify-Webhook-Id: b54557e4-bderered9-4b37-8a5f-bf7d70bcd043 (sample)

    3. Setup Webhook in Shopify

    Our REST API is now ready for use. Let us go into Shopify and set up this API in the webhook notification.

    Open your Shopify store as an Admin user and go to the settings section. In the notification menu, we will get all webhook notifications.

    Shopify Notification Webhook - SalesforceCodex

    Setup API URL for Customer Creation notification. We need to set up the URL which we have created in our Apex REST web service.

    We have created Apex Rest Resource – /shopify/webhook/v1/customer

    so complete URL will be https://{org-instance}.sandbox.my.salesforce-sites.com/services/apexrest/shopify/webhook/v1/customer

    Shopify Customer API Webhook -SalesforceCodex
    As we configured the webhook on customer creation. Whenever a new customer will be created, it will call configured REST API and that will create Account in Salesforce Org.

    4. Test Shopify integration with Salesforce

    Let us test the above implementation by creating customers in Shopify. Provide all required customer information to create a customer.

    Customer in Shopify - SalesforceCodex

    Once a customer is created in Shopify, it will create a customer in Salesforce.

    Account Creation in Salesforce - SalesforceCodex

    References

    Webhook

    Stop Serialization and Deserialization of Object In Apex

    Exposing Apex Classes as REST Web Services

    Similar Posts

    Using Salesforce Bulk API V1

    How to Seamlessly Integrate Shopify with Salesforce

    Create OCR App using Salesforce Einstein OCR API

    Common Issues

    1. Object Access issue – Provide access to objects that are used in apex rest implementation
    2. Apex class access Issue – Apex class should be added to site profile

    For another issue, try to create a debug log for the site user and find out the issue. You can also check Apex REST API using POSTMAN.

    Need Help?

    Need some kind of help in implementing this feature, connect on linked-in profile.

    apex apex rest architecture integrate salesforce with shopify remote call in rest api salesforce salesforce apex salesforce shopify integration salesforce webhook salesforce webhook integration with shopify salesforce wehbook integration shopify api shopify salesforce integration sObject initializer webhook in salesforce
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleVerify Phone using Flow HTTP Callout
    Next Article Handle Heap Size for Apex Code Optimization
    Dhanik Lal Sahni
    • Website
    • Facebook
    • X (Twitter)

    With over 18 years of experience in web-based application development, I specialize in Salesforce technology and its ecosystem. My journey has equipped me with expertise in a diverse range of technologies including .NET, .NET Core, MS Dynamics CRM, Azure, Oracle, and SQL Server. I am dedicated to staying at the forefront of technological advancements and continuously researching new developments in the Salesforce realm. My focus remains on leveraging technology to create innovative solutions that drive business success.

    Related Posts

    By Dhanik Lal Sahni6 Mins Read

    Top 10 Salesforce Flow Features of Salesforce Summer ’25

    May 11, 2025
    By Dhanik Lal Sahni6 Mins Read

    Unlock the Power of Vibe Coding in Salesforce

    April 30, 2025
    By Dhanik Lal Sahni5 Mins Read

    How to Implement Dynamic Queueable Chaining in Salesforce Apex

    April 21, 2025
    View 9 Comments

    9 Comments

    1. Pingback: Quick Text in Salesforce - SalesforceCodex

    2. Pingback: Can Chat GPT Replace Salesforce Developer? - SalesforceCodex

    3. Pingback: Apex Enhancement in Salesforce Winter ’23 - SalesforceCodex

    4. Pingback: Difference between WebHook and API Polling - Salesforce Codex

    5. Pingback: Post Chatter Feed Using FeedItem in Flow - SalesforceCodex

    6. Pingback: What is Salesforce Genie? - Salesforce Codex

    7. Ramnath Mandal on August 1, 2023 3:16 pm

      I am using a developer account. what url should I use in the webhook?

      Reply
      • Dhanik Lal Sahni on August 9, 2023 5:40 pm

        Hello Ramnath,

        This is already covered in post. You have to create public API and assign public API url in Shopify Webhook. Please check and if you still have issue, ping me on linked in.

        Thank You,
        Dhanik

        Reply
    8. Pingback: Integrate Shopify with Salesforce | SalesforceCodex

    Leave A Reply Cancel Reply

    Ranked #1 SALESFORCE DEVELOPER BLOG BY SALESFORCEBEN.COM
    Featured on Top Salesforce Developer Blog By ApexHours
    Recent Posts
    • Top 10 Salesforce Flow Features of Salesforce Summer ’25
    • Unlock the Power of Vibe Coding in Salesforce
    • How to Implement Dynamic Queueable Chaining in Salesforce Apex
    • How to Implement Basic Queueable Chaining in Salesforce Apex
    • How to Suppress PMD Warnings in Salesforce Apex
    Ranked in Top Salesforce Blog by feedspot.com
    RSS Recent Stories
    • How to Connect Excel to Salesforce to Manage Your Data and Metadata February 9, 2025
    • Difference Between With Security and Without Security in Apex January 2, 2025
    • Top Reasons to Love Salesforce Trailhead: A Comprehensive Guide December 5, 2024
    • How to Utilize Apex Properties in Salesforce November 3, 2024
    • How to Choose Between SOQL and SOSL Queries July 31, 2024
    Archives
    Categories
    Tags
    apex (110) apex code best practice (8) apex rest (11) apex trigger best practices (4) architecture (22) Asynchronous apex (9) AWS (5) batch apex (9) batch processing (4) code optimization (8) code review tools (3) custom metadata types (5) design principle (9) einstein (3) flow (15) future method (4) google (6) google api (4) integration (19) integration architecture (6) lighting (8) lightning (64) lightning-combobox (5) lightning-datatable (10) lightning component (29) Lightning web component (61) lwc (50) named credential (8) news (4) optimize apex (3) optimize apex code (4) Permission set (4) Queueable (9) rest api (23) S3 Server (4) salesforce (140) salesforce apex (46) salesforce api (4) salesforce api integration (5) Salesforce Interview Question (4) salesforce news (5) salesforce question (5) solid (6) tooling api (5) Winter 20 (8)

    Get our newsletter

    Want the latest from our blog straight to your inbox? Chucks us your detail and get mail when new post is published.
    * indicates required

    Ranked #1 SALESFORCE DEVELOPER BLOG BY SALESFORCEBEN.COM
    Featured on Top Salesforce Developer Blog By ApexHours
    Recent Posts
    • Top 10 Salesforce Flow Features of Salesforce Summer ’25
    • Unlock the Power of Vibe Coding in Salesforce
    • How to Implement Dynamic Queueable Chaining in Salesforce Apex
    • How to Implement Basic Queueable Chaining in Salesforce Apex
    • How to Suppress PMD Warnings in Salesforce Apex
    Ranked in Top Salesforce Blog by feedspot.com
    RSS Recent Stories
    • How to Connect Excel to Salesforce to Manage Your Data and Metadata February 9, 2025
    • Difference Between With Security and Without Security in Apex January 2, 2025
    • Top Reasons to Love Salesforce Trailhead: A Comprehensive Guide December 5, 2024
    • How to Utilize Apex Properties in Salesforce November 3, 2024
    • How to Choose Between SOQL and SOSL Queries July 31, 2024
    Archives
    Categories
    Tags
    apex (110) apex code best practice (8) apex rest (11) apex trigger best practices (4) architecture (22) Asynchronous apex (9) AWS (5) batch apex (9) batch processing (4) code optimization (8) code review tools (3) custom metadata types (5) design principle (9) einstein (3) flow (15) future method (4) google (6) google api (4) integration (19) integration architecture (6) lighting (8) lightning (64) lightning-combobox (5) lightning-datatable (10) lightning component (29) Lightning web component (61) lwc (50) named credential (8) news (4) optimize apex (3) optimize apex code (4) Permission set (4) Queueable (9) rest api (23) S3 Server (4) salesforce (140) salesforce apex (46) salesforce api (4) salesforce api integration (5) Salesforce Interview Question (4) salesforce news (5) salesforce question (5) solid (6) tooling api (5) Winter 20 (8)

    Get our newsletter

    Want the latest from our blog straight to your inbox? Chucks us your detail and get mail when new post is published.
    * indicates required

    Facebook X (Twitter) Instagram Pinterest YouTube Tumblr LinkedIn Reddit Telegram
    © 2025 SalesforceCodex.com. Designed by Vagmine Cloud Solution.

    Type above and press Enter to search. Press Esc to cancel.

    Ad Blocker Enabled!
    Ad Blocker Enabled!
    Our website is made possible by displaying online advertisements to our visitors. Please support us by disabling your Ad Blocker.