Back in Stock for Mobile App Developers

read
Last updated at:

Overview

If you're building a mobile app and want to include Klaviyo's Back In Stock feature, it's easy to do this by simply making the correct API calls from your app. You have full control of (and responsibility for) when, where, and how the trigger button appears; the appearance, text, and behavior of the modal; and all other aspects of the feature's behavior and appearance within your mobile app.

Once you are successfully sending back in stock events to Klaviyo, you can set up a back in stock flow to ensure that those who subscribe to receive back in stock emails are notified.

This API endpoint is only valid for Shopify and BigCommerce stores. No other store or catalog systems are supported at this time.

Your POST request from the app must include:

  • a: Your public Klaviyo API Key (6 characters, can be retrieved from https://www.klaviyo.com/account#api-keys-tab)
  • email: The email address entered by the subscriber (must be correctly formatted & valid)
  • variant: The variant ID
  • platform: shopify or bigcommerce

To subscribe a customer to a list as part of the Back In Stock workflow, you will need to make a separate, additional call to our existing List API: https://www.klaviyo.com/docs/api/lists 

API Call Format for Shopify:

curl 'https://a.klaviyo.com/api/v1/catalog/subscribe' --data 'a=AccountID&email=test@klaviyo.com&variant=5000149172256&platform=shopify'

API Call Format for BigCommerce:

curl 'https://a.klaviyo.com/api/v1/catalog/subscribe' --data 'a=AccountID&email=test@klaviyo.com&variant=5000149172256&platform=bigcommerce'

Sample API Calls & Responses

Successful Call & Response for Shopify

curl 'https://a.klaviyo.com/api/v1/catalog/subscribe' --data 'a=AccountID&email=test0630@klaviyo.com&variant=44222393030&platform=shopify'

{"email": "test0630@klaviyo.com", "success": true}

The correct Account ID and a valid email address must be included to receive a successful response.

Successful Call & Response for BigCommerce

curl 'https://a.klaviyo.com/api/v1/catalog/subscribe' --data 'a=AccountID&email=test0630@klaviyo.com&variant=44222393030&platform=bigcommerce'

{"email": "test0630@klaviyo.com", "success": true}

The correct Account ID and a valid email address must be included to receive a successful response.

Invalid Calls & Responses

Invalid Email Address for Shopify:

curl 'https://a.klaviyo.com/api/v1/catalog/subscribe' --data 'a=AccountID&email=test@klaviyo&variant=44221714950&platform=shopify'

{"errors": ["There was something wrong with your request. Please try again."], "data": {}, "success": false}

Invalid Email Address for BigCommerce:

curl 'https://a.klaviyo.com/api/v1/catalog/subscribe' --data 'a=AccountID&email=test@klaviyo&variant=44221714950&platform=bigcommerce'

{"errors": ["There was something wrong with your request. Please try again."], "data": {}, "success": false}

Invalid Public API Key for Shopify

curl 'https://a.klaviyo.com/api/v1/catalog/subscribe' --data 'a=BadKey&email=test@klaviyo.com&variant=44221714950&platform=shopify'

{"errors": ["There was something wrong with your request. Please try again."], "data": {}, "success": false}

Invalid Public API Key for Bigcommerce

curl 'https://a.klaviyo.com/api/v1/catalog/subscribe' --data 'a=BadKey&email=test@klaviyo.com&variant=44221714950&platform=bigcommerce'

{"errors": ["There was something wrong with your request. Please try again."], "data": {}, "success": false}

Invalid Variants & Duplicate Subscriptions

Invalid Variant ID

If an invalid variantID is included in a request, the API will return a standard success response as the API does not validate variant IDs. No event will be created for this profile, and the customer will not be queued to receive a back in stock message.

Duplicate Subscription Requests

If multiple requests are submitted for the same email address on the same variant, only the first will be accepted. It is not possible to submit multiple events for a profile on the same variant.

There is no limit to the number of unique variants that a profile can subscribe to. A single person can sign up to be notified for hundreds or thousands of unique variants.

Once you have your back in stock flow set up, after an individual receives an email notifying them that a specific variant is back in stock, their existing subscription is cleared. They are then able to sign up for another subscription on that same variant.  It is not possible to have multiple concurrent subscriptions to the same variant for a single profile.

Please note that no subscribers will be notified when an item is restocked if you do not first set up a back in stock flow.

 

x
Was this article helpful?
1 out of 6 found this helpful