Insights · AI agents

Product availability chatbot: auto-notify customers when stock is back.

A product availability chatbot answers “is it in stock?” from your live inventory and, when the answer is no, saves the customer's request and messages them automatically when an inventory webhook — on Shopify, inventory_levels/update — shows the item available again. On WhatsApp that alert is sent as a marketing template, needs the customer's opt-in and cannot reach US numbers. Below: how it works, the published rules, a six-step build, one request end to end and the pitfalls.

Back-in-stock chatbot

Trigger
Inventory webhook, e.g. Shopify inventory_levels/update
Stored
One request per customer and variant
WhatsApp alert
Marketing template, opt-in first
Not delivered to
US numbers (marketing templates)
If capped
Error 131049, wait 24 hours

What the chatbot does: three jobs

On Shopify, the inventory_levels/update webhook occurs whenever an inventory level is updated and requires the read_inventory scope. Its payload carries the inventory_item_id, the location_id, the available quantity and updated_at — a quantity per location, not a total for the product, which matters for the pitfalls below. Nobody has to watch the stock page: the alert follows the inventory event.

  • Answer from live stock. When a customer asks about a product, the chatbot looks up the exact variant — size, colour — in the shop's inventory instead of reading a product page that may be out of date.
  • Record the request. If the variant is out of stock, it offers to notify the customer and saves one request: who, which variant, on which channel, and the opt-in they gave.
  • Send the alert by itself. When the shop platform reports new stock, a small service matches the inventory item against the open requests and sends each customer one message, then closes the request.
Published rules

What the platforms' documentation sets

RuleWhat it means for a back-in-stock alertSource
Utility templates must be non-promotional and specific to or requested by the userAn alert that points the customer back to a product to buy is promotional, so it does not meet both criteriaMeta — Template categorization
Retargeting messages that promote or recommend products to people who engaged with you are marketing even if requested by usersA back-in-stock alert is a marketing template, even though the customer pressed “Notify me”Meta — Template categorization
Since 9 April 2025, a template submitted as UTILITY that WhatsApp judges to be marketing is approved as MARKETINGSubmitting the alert as utility does not make it cheaper; it changes category on approvalMeta — Template categorization
WhatsApp does not currently deliver marketing templates to users with US phone numbersUS customers need another channel for the alert, such as e-mailMeta — Per-user marketing limits
A template capped by the per-user marketing limit fails with error 131049; wait at least 24 hours before resendingThe alert can fail even with opt-in; the service must retry later, not in a loopMeta — Per-user marketing limits
Opt-in must state that the person is opting in to receive messages and name the businessThe “Notify me” step must say who will message them and on which channelMeta — Getting opt-in
The same webhook can be delivered more than once, for example after a network timeout or a retryDeduplicate with X-Shopify-Webhook-Id so one restock never sends two alertsShopify — Verify deliveries
Build

Build it in six steps

  1. 01

    1. Connect the inventory

    Give the chatbot a read-only tool that returns the available quantity of one variant, and subscribe a service to the shop's inventory event — on Shopify, inventory_levels/update with the read_inventory scope.

  2. 02

    2. Write the notify-me flow

    When a variant is out of stock, the chatbot offers a “Notify me” button. The wording names your business and says the customer is opting in to receive a message, as Meta's opt-in requirements ask.

  3. 03

    3. Store one request per customer and variant

    Save the inventory item ID, the customer's channel and number or e-mail, the opt-in text they accepted and its date. A second request for the same variant updates the first rather than adding a duplicate.

  4. 04

    4. Get the alert template approved

    Submit it as a marketing template with the product name and a link as variables, and nothing else promotional in it. Prepare an e-mail version for customers on US numbers.

  5. 05

    5. Handle the webhook safely

    Acknowledge with a 200 OK within Shopify's five-second timeout, queue the event, skip duplicates by X-Shopify-Webhook-Id, ignore an event older than the last one recorded for that item, and check the variant is really sellable before sending.

  6. 06

    6. Send, close and log

    Send one alert per open request, mark it closed, and log failures: on error 131049, retry once after at least 24 hours. A customer who replies lands back in the chatbot, which can check stock again and take the order.

Example

One request, end to end

A customer writes to a shoe shop's WhatsApp number: “Do you have the trail runner in size 9?” The chatbot checks the variant, finds nothing available and replies: “Size 9 is out of stock right now. Would you like [shop name] to send you one WhatsApp message when it is back?” with two buttons, Notify me and No thanks. The customer taps Notify me; the request is saved with the variant, the number and the accepted wording.

When the warehouse later receives a delivery, the stock is updated. Shopify sends inventory_levels/update for that inventory item at the warehouse location with a positive available quantity. The service finds the open request and sends the approved marketing template: “Good news: the trail runner in size 9 is back in stock. See it here: {{1}}”. The customer replies “Can you hold one for me?”, and the conversation is back with the chatbot and, if needed, a member of staff.

Pitfalls

What goes wrong

  • Treating a location quantity as the product's stock. The Shopify payload gives the available quantity at one location. A unit back at a store that does not ship online should not trigger an online alert.
  • Alerting twice. The same webhook can arrive more than once; Shopify retries 8 times over the next 4 hours if your endpoint fails. Close the request at the first send and deduplicate.
  • Alerting for one unit when many people wait. If stock is low, decide the order — first come, first served — and say in the message that stock is limited, rather than promising an item to everyone.
  • Counting on utility pricing. A back-in-stock alert promotes a product; submitted as utility, it is approved as marketing. Repeated misuse of utility templates can lead Meta to recategorize all of an account's utility templates as marketing for a period.
  • Forgetting US customers. Marketing templates are not delivered to US numbers on WhatsApp, so their alert fails unless another channel is set.
  • Leaving requests open forever. Give each request an expiry and let the customer cancel it from the chat; an alert months later, about a product they no longer want, invites a block. Our note on WhatsApp frequency capping covers the per-person limits in more detail.

Sources

About this article

Written by the Takat AI team from the projects we build and run. Facts about third-party services are checked against their official documentation on the date shown; figures come from the sources listed. Last reviewed .

FAQ

Frequently asked questions

  • What is a product availability chatbot?

    A chatbot that answers stock questions from your live inventory and, when an item is out of stock, saves the customer's request and notifies them automatically when an inventory update shows the item available again.

  • How does a chatbot know when a product is back in stock?

    It listens to the shop's inventory events rather than checking pages. On Shopify, the inventory_levels/update webhook occurs whenever an inventory level is updated and carries the available quantity for one location.

  • Is a WhatsApp back-in-stock alert a utility or a marketing template?

    Marketing. Meta's guidelines class messages that promote or recommend products to people who engaged with you as marketing even if requested by users, and since 9 April 2025 a template submitted as utility that WhatsApp judges to be marketing is approved as marketing.

  • Can I send back-in-stock alerts on WhatsApp to US customers?

    Not as marketing templates: WhatsApp does not currently deliver them to users with US phone numbers. Use another channel, such as e-mail, for those customers.

  • What does error 131049 mean for a back-in-stock alert?

    The marketing template was not delivered because of the per-user marketing limit. Meta asks you to wait at least 24 hours before resending it.

Stock questions arriving in your chats?

We build WhatsApp agents that answer from your live inventory and send the alert when stock is back.