Integrating Shopify with a CRM like HubSpot or Salesforce is one of the most powerful steps a brand can take toward building an automated, data-driven sales and marketing ecosystem. As online stores scale, manually exporting data or relying on basic connectors becomes ineffective. Businesses need real-time syncing, with Shopify orders, customers, and lifecycle events instantly available in the CRM. This is where a webhook + API integration architecture becomes essential.
In this guide, we’ll explore how Shopify integrates with HubSpot and Salesforce using webhooks, Python, and Node.js; how to build a scalable middleware layer; and how enterprises can automate customer journeys, sales pipelines, and segmentation workflows.
This is useful for ecommerce operations, marketing teams, and technical stakeholders—especially those investing in long-term Shopify Store Development and data automation.
Why Integrate Shopify With HubSpot or Salesforce?
Shopify captures ecommerce interactions. CRMs manage relationships, sales, opportunities, and multi-channel campaigns. When both systems operate independently, teams struggle with:
- Delayed visibility into customer activity
- Manual data entry errors
- Misaligned follow-ups
- Poor segmentation and campaign performance
- Inefficient follow-ups A real-time integration ensures:
Shopify- HubSpot/Salesforce
- New customers become Contacts
- Orders become Deals/Opportunities
- Checkout events trigger marketing automation
- VIP customer events trigger sales outreach
- Refunds and Cancellations sales outreach
- Refunds and cancellations update the CRM lifecycle
HubSpot/Salesforce-Shopify
- Customer Tgas
- Lifecycle stage
- Lead score
- Custom properties
- Sales notes
Together, these systems create a unified data loop that drives retention, revenue, and more intelligent decision-making.
Understanding the Integration Architecture
1. Shopify emits webhooks
When events occur(orders, checkouts, customers), Shopify immediately pushes JSON payloads to your server.
Examples:
orders/createcustomers/createcheckouts/updateorders/fulfilled
2. Middleware receives and validates the webhook
This is usually a:
- Node.js server
- Python API
- Serverless functions (AWS Lambda,Azure Functions
Its role:
- Validate Shopify HMAC signature
- Parse webhook request
- Transform data
- Call HibSpot or Salesforce APIs
3. CRM API receives data
HubSpot or Salesforce stores the data as:
- Contacts
- Leads
- Deals
- Opportunities
- Activities
- Custom Objects
4. CRM triggers automation workflows
Examples:
- HubSpot sequences
- Salesforce flows
- Lead scoring
- Lifecycle updates
This architecture enables scalable, event-driven automation without manual intervention.
Step-by-step: Buinding The Integration
We'll use both Node.js (for webhook receiver) and Python for(CRM API calls)
Step 1: Receive Shopify Webhook(Node.js)
Install required packages:
npm install express body-parser crypto axios
Create a basic server:
const express = require("express");
const crypto = require("crypto");
const bodyParser = require("body-parser");
const axios = require("axios");
const app = express();
app.use(bodyParser.raw({ type: "application/json" }));
const SHOPIFY_SECRET = process.env.SHOPIFY_SECRET;
Verify Shopify HMAC signature
function verifyHmac(req) {
const hmacHeader = req.headers["x-shopify-hmac-sha256"];
const digest = crypto
.createHmac("sha256", SHOPIFY_SECRET)
.update(req.body)
.digest("base64");
return digest === hmacHeader;
}
Webhook Endpoint
app.post("/webhooks/orders-create", async (req, res) => {
if (!verifyHmac(req)) return res.status(401).send("Invalid HMAC");
const order = JSON.parse(req.body.toString());
// send to HubSpot or Salesforce
await axios.post("http://localhost:5000/sync", order);
res.status(200).send("OK");
});
This connects Shopify-Node.js Middleware-CRM.
Step 2: Process Data and Push to CRM (Python)
Install dependencies:
pip install flask requests python-dotenv
Create a Flask API:
from flask import Flask, request
import requests
import json
app = Flask(__name__)
HubSpot: Create Deal & Contact
def create_hubspot_deal(order):
url = "https://api.hubapi.com/crm/v3/objects/deals"
headers = {"Authorization": f"Bearer {HUBSPOT_KEY}"}
payload = {
"properties": {
"dealname": f"Order #{order['id']}",
"amount": order["total_price"],
"pipeline": "default",
"dealstage": "closedwon"
}
}
return requests.post(url, json=payload, headers=headers)
Salesforce: Create Opportunity
def create_salesforce_opportunity(order):
payload = {
"Name": f"Order #{order['id']}",
"StageName": "Closed Won",
"CloseDate": "2025-01-01",
"Amount": float(order["total_price"])
}
res = requests.post(
f"{SF_INSTANCE}/services/data/v57.0/sobjects/Opportunity/",
json=payload,
headers={"Authorization": f"Bearer {SF_TOKEN}"}
)
return res.json()
Receive data from Node.js and sync to CRM
@app.post("/sync")
def sync_order():
order = request.json
create_hubspot_deal(order)
create_salesforce_opportunity(order)
return "Synced", 200
What Data Should You Sync
1. Customer fields
- Name
- Phone
- Tags
- Accepts marketing
2. Order fields
- Product names
- Total price
- SKU list
- Discounts
- Taxes
- Shipping info
3. Behavioural events
- Cart updates
- Checkout abandoned
- Fulfillment events These help Build Stronger CRM segmentation and better follow-up workflows.
How HubSpot Uses These Events
- Trigger abandoned cart flows
- Add contacts to lists based on products
- Trigger lead score updates
- Build post-purchase sequences
- Create custom dashboards with Shopify analytics
HubSpot’s workflows become exponentially smarter after the integration.
How Salesforce Uses These Events
- Create Opportunities for every order
- Sync customers into Contacts or Accounts
- Auto-assign leads to sales reps
- Build pipeline forecasting
- Trigger service cloud workflows
Salesforce is ideal for enterprise merchants running B2B or hybrid models.
Advanced Automation Features
To enhance the integration:
Add a Queue (Redis, RabbitMQ)
Prevents data loss during traffic spikes.
Add Error Logging & Reprocessing
For failed CRM sync attempts.
Add Custom Objects
For loyalty events, subscriptions, or bundling logic.
Sync Refund Events
Update CRM pipeline and lifecycle stage instantly.
Use GraphQL Admin API
Fetch richer Shopify data in real time.
These features make the integration scalable and enterprise-grade.
Real-World Use Cases
1. Automated Lead Qualification
Every new Shopify customer → HubSpot Contact → Lead scoring.
2. Personalized Email Flows
Orders trigger product education emails.
3. Sales Outreach
High-value customers move into Salesforce as Opportunities.
4. Unified Data Warehouse
Use CRM + Shopify data for Power BI, Looker, or Snowflake dashboards.
5. VIP Customer Tagging
Lifetime value synced → CRM triggers VIP workflows.
When You Need Professional Help
Building a real-time, multi-system, event-driven integration usually requires advanced API design, authentication management, and reliable error handling. This is where businesses often prefer to Hire Dedicated Shopify Developer teams who specialize in building scalable automation and CRM integrations.
Conclusion
A webhook + API integration between Shopify and HIbspot or Salesforce creates a powerful, automated, real-time data pipeline for ecommerce brands. Orders, customers, and beg=havioural events flow instantly into CRM pipelines, enabling smarter segmentation, better communication, faster sales follows, and accurate revenue forecasting.
With the combination of Shopify’s event-driven architecture and the flexibility of HubSpot/Salesforce APIs, businesses can build custom automation tailored to their exact workflows. Whether you need syncing, segmentation, or enterprise-grade analytics, this architecture lays the foundation for scalable growth.
Top comments (0)