[Beta]{class="badge informative"}
Shopify Streaming
51黑料不打烊 Experience Platform provides support for ingesting data from streaming applications. Support for streaming providers include Shopify.
Prerequisites prerequisites
The following section outlines prerequisite steps to complete before using the Shopify Streaming source.
You must have a valid Shopify partner account in order to connect to the Shopify APIs. If you do not already have a partner account, please register using the .
Create your application
With a valid Shopify partner account, you can now proceed and create your app using the partners dashboard. For comprehensive steps on how to create your app in Shopify, read the .
Once your app is created, retrieve your client ID and client secret from the client credentials tab of the Shopify partners dashboard. The client ID and client secret will be used in the next steps to retrieve your authorization code and access token.
Retrieve your authorization code
Next, retrieve your authorization code by entering your domain鈥檚 myshopify.com
URL into your browser, along with query strings that define your API key, scopes, and the redirect URI.
The format for this URL is as follows:
API format
https://{SHOP}.myshopify.com/admin/oauth/authorize?client_id={API_KEY}&scope={SCOPES}&redirect_uri={REDIRECT_URI}
shop
myshopify.com
URL.api_key
scopes
scope=write_orders,read_customers
to allow permissions to modify orders and read customers.redirect_uri
Request
https://connnectors-test.myshopify.com/admin/oauth/authorize?client_id=l6fiviermmzpram5i1spfub99shms3j9&scope=write_orders,read_customers&redirect_uri=https://acme.com
Response
A successful response returns your redirect URL, including the authorization code required to generate your access token.
丑迟迟辫蝉://飞飞飞.补肠尘别.肠辞尘/?肠辞诲别=办6箩2辫补濒驳谤产濒箩箩补228辞耻8肠20蹿尘苍7飞41驳锄虫26;丑尘补肠=68肠9163蹿772别别肠产肠8848肠90蹿695产肠补0460899肠125补蹿897补6诲2产0别产产诲59诲3补43产虫26;蝉丑辞辫=肠辞苍苍苍别肠迟辞谤蝉-迟别蝉迟.尘测蝉丑辞辫颈蹿测.肠辞尘虫26;蝉迟补迟别=123456脳迟补尘辫=1658305460
Retrieve your access token
Now that you have your client ID, client secret, and authorization code, you can retrieve your access token. To retrieve your access token, make a POST request to your domain鈥檚 myshopify.com
URL while appending this URL with Shopify鈥檚 API endpoint: /admin/oauth/access_token
.
API format
POST /{SHOP}.myshopify.com/admin/oauth/access_token
Request
The following request generates an access token for your Shopify instance.
curl -X POST \
'https://connnectors-test.myshopify.com/admin/oauth/access_token' \
-H 'developer-token: {DEVELOPER_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'Cookie: _master_udr=xxx; request_method=POST'
-d '{
"client_id": "l6fiviermmzpram5i1spfub99shms3j9",
"client_secret": "dajn3caxz9s7ti624ncyv_m4f60jnwi3ii3y3k",
"code": "k6j2palgrbljja228ou8c20fmn7w41gz"
}'
Response
A successful response returns your access token and permission scopes.
{
"access_token": "shpca_wjhifwfc91psjtldysxd6rqli371tx54",
"scope": "write_orders,read_customers"
}
Create a webhook for streaming Shopify data webhook
Webhooks allow applications to stay synchronized with your Shopify data or perform an action after a particular event occurs in a shop. For streaming Shopify data to Experience Platform, webhooks can be used to define the http endpoint and the topics for subscription.
Request
The following request creates a webhook for your Shopify Streaming data.
curl -X POST \
'https://connnectors-test.myshopify.com/admin/api/2022-07/webhooks.json' \
-H 'X-Shopify-Access-Token: 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' \
-H 'Content-Type: application/json' \; request_method=POST' \
-d '{
"webhook": {
"address": "https://dcs.adobedc.net/collection/9d411a24aa3c0a3eded92bac6c64d0da986ee7a8212f87168c5fb42d9ddc3227",
"topic": "orders/create",
"format": "json"
}
}'
webhook.address
webhook.topic
webhook.format
Response
A successful response returns information on your webhook, including its corresponding id
, address, and other metadata information.
{
"webhook": {
"id": 1091138715786,
"address": "https://dcs.adobedc.net/collection/9d411a24aa3c0a3eded92bac6c64d0da986ee7a8212f87168c5fb42d9ddc3227",
"topic": "orders/create",
"created_at": "2022-07-20T07:15:23-04:00",
"updated_at": "2022-07-20T07:15:23-04:00",
"format": "json",
"fields": [],
"metafield_namespaces": [],
"api_version": "2021-10",
"private_metafield_namespaces": []
}
}
Limitations limitations
The following is a list of known limitations that you may encounter when using webhooks with the Shopify Streaming source.
- It鈥檚 not guaranteed that you can arrange the order of delivery of different topics for the same resource. For example, it鈥檚 possible that a
products/update
webhook gets delivered before aproducts/create
webhook. - You can set your webhook to deliver webhook events to an endpoint at least once. This means that an endpoint may receive the same event more than once. You can scan for duplicate webhook events by comparing the
X-Shopify-Webhook-Id
header to previous events. - Shopify treats HTTP 2xx status responses as successful notifications. Any other status code responses are deemed as failures. Shopify provides a retry mechanism for failed webhook notifications. If there is no response after waiting for five seconds, Shopify retries the connection 19 times over the course of the next 48 hours. If there are still no responses by the end of the retry period, then Shopify deletes the webhook.
Next steps
The following tutorials provide steps on how to connect your Shopify Streaming source to Experience Platform using the API and the UI: