Create Alert Request
Our app provides a JS widget that is compatible with Cornerstone and themes that have similar markup. With incompatible themes, there will be some development work required in order to be able to show the back-in-stock alerts form on the product detail page when an item or variant is out of stock.
One approach is to implement the frontend component yourself and send alert requests directly to our storefront API.
Create Alert Request
Endpoint
POST
: https://backinstockalerts.space48apps.com/api/${store_hash}/alert-requests
store_hash
: string;- This is your store identifier, typically find in the URL of your BigCommerce admin panel.
Body
first_name
?: string;last_name
?: string;email
: string;newsletter
?: boolean;channel_id
: number;customer_id
: number | null;currency_id
: number | null;product_id
: number | string;product_variant_sku
: string | null;
Example
{ "first_name":"Tom", "last_name":"", "email":"[email protected]", "newsletter":true, "product_id":"103", "channel_id":1, "customer_id":null, "currency_id":1, "product_variant_sku":"CLC-LA" }<br>
Responses
200
Successful
- data: AlertRequest;
id
: number;channel_id
: number;created_at
: string;customer
: Customer;email
: string;
order_total
: string
Example
{ "data": { "id": 65, "channel_id": 1, "created_at": "2023-01-19 09:32:16", "customer": { "email": "[email protected]" }, "order_total": "\u00a30"}, }
4XX
Invalid request, e.g. 422: Unable to create alert request, e.g. email address is already subscribed to alerts for this product.
errors
:email
?: string[]channel_id
?: string[]customer_id
?: string[]currency_id
?: string[]product_id
?: string[]product_variant_sku
?: string[]first_name
?: string[]last_name
?: string[]newsletter
?: string[]
message
: string
Example
{ "message": "You are already subscribed to alerts for this product.", "errors": { "email": [ "You are already subscribed to alerts for this product." ] } }