Fetch Subscriptions [Beta]
Fetch all subscriptions of a Shopper
swat.fetchSubscriptions
Fetch all subscriptions a shopper is subscribed to.
Back in Stock Markets Integration SupportFetching subscriptions is currently not supported for stores using the Back in Stock Markets solution. Stores using Shopify Markets with the standard Back in Stock app are not affected.
For updates on subscription support for the Back in Stock Markets solution, please contact [email protected].
Definition
swat.fetchSubscriptions(params, onSuccess, onError)
Example
Follow the example for retrieving backinstock or coming-soon subscriptions across all mediums or filtered by a specific medium.
let params = {
topic: 'backinstock',
medium: 'email' // Optional - 'email' or 'sms', When not specified fetches all mediums
}
// Success Callback
let onSuccess = function(response) {
console.log("Fetch Subscriptions Response", response);
}
// Error Callback
let onError = function(error) {
console.log("Error While Fetching Subscriptions", error);
}
// Sample call
swat.fetchSubscriptions(params, onSuccess, onError);let params = {
topic: 'comingsoon',
medium: 'email' // Optional - 'email' or 'sms', When not specified fetches all mediums
}
// Success Callback
let onSuccess = function(response) {
console.log("Fetch Subscriptions Response", response);
}
// Error Callback
let onError = function(error) {
console.log("Error While Fetching Subscriptions", error);
}
// Sample call..
swat.fetchSubscriptions(params, onSuccess, onError);API Parameters
| Argument | Type | Description |
|---|---|---|
| params | object | topic - We offer support for two topics: "comingsoon" and "backinstock". medium - Optional parameter - When not specified fetches all mediums or filter by email or sms |
| onSuccess | function | Function that gets called after a successful API call |
| onError | function | Function that gets called when an error occurs |
Response
{
// Limit
"limit": 10,
// Offset
"offset": 0,
// Total number of records that is available for this shopper
"total": 1,
"subscriptions": [
{
// Medium that the shopper subscribed to
"medium": "email",
// Title of the product that the shopper subscribed to
"dt": "Ceramic Oval Basin",
// Created Timestamp
"cts": 1713410738844,
// Topic to which the shopper subscribed to
"topic": "backinstock",
// Product ID of the product to which the shopper subscribed to
"empi": 7096231231686,
// created by - This will be available when this was manually created by someone else other than merchant
// This will be available(not redacted) if the shopper is logged in
"cby": "",
// Product URL
"du": "https://demo.swym.it/products/ceramic-oval-basin",
// Unique identifier for the store
"pid": "KABSbuGyYCuM6/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
// Variant ID of the product to which the shopper subscribed to
"epi": 41254655393990,
// Status of the subscription 0 when not sent, 1 when sent and 2 when processing
"status": 0,
// Medium value with which the shopper subscribed
// This will be available(not redacted) if the shopper is logged in
"mediumvalue": "[email protected]",
// Updated Timestamp
"uts": 1713410738844,
// Image URL of the product to which the shopper subscribed
"iu": "https://demo.swym.it/cdn/shop/products/[email protected]?v=1637582881",
// updated by - This will be available when this was manually updated by someone else other than merchant
// This will be available(not redacted) if the shopper is logged in
"uby": "",
// Price of the product to which the shopper subscribed
"pr": 300,
// Category of the product to which the shopper subscribed
"ct": "",
// Variant title of the variant to which the shopper subscribed
"vi": "Default Title"
}
]
}Updated 8 days ago
Did this page help you?
