Catalog integration and real-time inventory checks
Updated: Sep 4, 2026
Copy for LLM
This page covers linking a product catalog to Meta Business Agent, keeping the catalog matched to your inventory system, and adding the connector tools that answer the live question — including a location step that has to happen before the agent can answer anything about stock. Once this is set up the agent can tell shoppers what you sell as well as what is on the shelf this morning at the branch nearest them.
The agent handles:
- Product discovery from a linked Meta product catalog
- Resolving the shopper to a fulfillment location before quoting stock
- Live stock checks per SKU at that location, rather than a global in-stock flag
- Reporting a substitute at the same location when the exact item is unavailable
- Refusing to state availability when the inventory system cannot be reached
- Revalidating availability when the shopper changes their delivery address
Who this guide is for
The examples use a multi-branch hardware retailer, but the pattern fits any business where availability depends on where the shopper is. If you fulfill everything from one warehouse and never run out, you do not need this: the catalog alone is enough. The complexity here earns its place when stock differs by location, moves quickly, or both.
| Organization type | What varies by location | What the agent must check |
|---|---|---|
Hardware and building supplies | Branch stock, bulk quantities, collection times | Quantity at the chosen branch, not the chain total |
Grocery and convenience | Daily stock, short shelf life, substitutions | Whether the item is in today’s assortment at that store |
Automotive parts | Fitment plus depot stock | The part matches the vehicle and exists at a reachable depot |
Garden centers and nurseries | Seasonal lines, living stock held per site | Whether the variety is in stock at that site this season |
Tire and fitting centers | Tire stock and fitting capacity per site | Both the tire and a fitting slot at the same location |
This guide is about the availability layer beneath other flows rather than a conversation shape of its own. If you want the agent to interpret a described need and present options, see Smart product recommendations. If the shopper is assembling a basket over several turns, see Multi-item cart management. If they have already named one product and need the right variant, see Single item purchase agent.
Each step below notes how the API is used in other scenarios, then applies it to the hardware retail example.
Prerequisites
Have the following in place before you configure catalog and inventory checks. The first three come from Meta Business Agent onboarding; the fourth is a Meta product catalog managed in Commerce Manager; the fifth is your own system.
- An onboarded and enabled Meta Business Agent (
rollout.enabled: true) — see End-to-end setup - A valid system user access token (SUAT) or Business Integration System User (BISU) token with the
whatsapp_business_messagingpermission — see Generate an access token - Your WhatsApp Business phone number ID (
{entity_id}) — the phone number the agent is enabled on, not the WhatsApp Business account ID. Find it in WhatsApp Manager under Account tools > Phone numbers - A Meta product catalog owned by the same business, required by Link your product catalog
- A publicly accessible HTTPS endpoint that can resolve a postcode to a fulfillment location and report stock at that location, required by Define connector tools
Link your product catalog
Create the catalog and manage its products in Meta Commerce Manager, not through the Meta Business Agent API. Once the catalog is connected to the WhatsApp Business Account, the agent can see its products.
There are three ways to connect it, and any one is enough.
Connect it in WhatsApp Manager. The quickest route if the catalog already exists. In WhatsApp Manager, select Account tools > Catalog in the left sidebar, then click Choose a Catalog. In the Connect a Catalog dialog that displays, search by catalog name or ID, select the catalog, and click Connect Catalog.
Connect it with the Product Catalogs API. Use this to automate onboarding. Note the ID: this call is made against the WhatsApp Business Account ID, not the
{entity_id} phone number ID used everywhere else in this guide. The token needs the whatsapp_business_management permission.curl -X POST "https://graph.facebook.com/{WHATSAPP_BUSINESS_ACCOUNT_ID}/product_catalogs" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"catalog_id": "1234567890123456"
}'
A WhatsApp Business Account holds at most one catalog. Attaching a second one fails rather than replacing the first, so detach the existing catalog before connecting a different one.
GET the same edge to read what is currently linked, and DELETE it to detach. See the Product Catalogs reference for the full contract.Link it to the business in Commerce Manager. Link the catalog to the business that owns the WhatsApp Business phone number, and the agent picks it up the same way. Use this route when you are setting the catalog up for the first time and are already in Commerce Manager.
Connect the catalog before you configure anything else. Products go through processing after a catalog is connected or updated, and they are not visible to the agent until that completes. Check the catalog’s status in Commerce Manager rather than assuming a fresh upload is live; a product still in review behaves exactly like a product that does not exist.
What belongs in the catalog
The dividing line is how often a value changes. Catalog values are read as a snapshot; connector values are read live.
| Kind of information | Where it belongs | Why |
|---|---|---|
Product name, description, imagery | Catalog | Changes rarely, and the agent needs it to match a shopper’s words |
Variant attributes such as size, color, material | Catalog | Used to disambiguate before any stock call |
List price | Catalog | Fine as a display default, but treat the connector as authoritative |
Whether a line is discontinued | Catalog availability | Coarse and slow-moving, which is what this field is for |
Quantity on hand | Connector | Changes minute to minute |
Stock at a specific branch | Connector | The catalog has no concept of your locations |
Promotional or member pricing | Connector | Varies by shopper and by day |
Delivery window for a postcode | Connector | Depends on the address, which the catalog never sees |
Use
item_group_id on every product with variants. Without it the agent treats each variant as an unrelated product, so a shopper asking for a 25mm fixing can be shown three lengths of the same item as three separate suggestions, and a stock check on the wrong one.Keep SKUs identical between the catalog and your inventory system. The whole design below depends on the agent being able to take an identifier from the catalog and hand it to your API unchanged. Where the two systems disagree — a catalog carrying retail SKUs and a warehouse carrying internal part numbers — put the mapping in your endpoint, never in the agent instructions. An agent asked to transform identifiers will occasionally invent one that looks plausible.
Where else this applies. Every catalog-backed agent needs this split decided explicitly, because the failure it prevents is the worst kind: an answer that is confidently wrong rather than obviously missing. Write the list down for your own business before configuring anything, and revisit it whenever someone asks for a new field in the catalog.
Add agent instructions
Agent instructions shape how the agent responds. The
title is a short identifier limited to lowercase letters, numbers, and hyphens, description tells the agent when to apply the instruction, and skill contains the instruction text.The instruction for this layer exists to enforce ordering: location first, then stock, then an offer.
curl -X POST "https://api.facebook.com/{entity_id}/agent_config/skills" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-H "X-API-Version: 2.0.0" \
-d '{
"title": "stock-and-availability",
"description": "Applied whenever a shopper asks whether something is available, how many are in stock, when it can be delivered, or asks to buy or reserve an item.",
"skill": "Ask for a postcode before answering any availability, price, or delivery question, and call resolve_location with it. Reuse the location already established in this conversation instead of asking again. Call check_stock in the same turn you state availability, and never state availability from an earlier turn or from the catalog alone. State the quantity available only when the shopper asked how many; otherwise say whether it is available and when they can have it. When the item is unavailable at the resolved location, say so plainly and offer the substitute the tool returned, labeled as a substitute, and never suggest another branch, which no tool on this page can check. When check_stock fails or returns nothing, say you cannot confirm availability right now and do not guess. When the shopper changes their postcode, call resolve_location again and recheck every item already discussed before continuing."
}'
The instruction to recheck after a postcode change is the one most often left out, and it produces the most damaging failure. A shopper who gets a quote for one address and then gives a different delivery address is holding a set of answers that are no longer true, and nothing in the conversation signals that.
Where else this applies. Any agent whose answers depend on a resolved context needs a rule for what happens when that context changes mid-conversation. The pattern is the same for a delivery address, a travel date, or a chosen branch: re-resolve, then revalidate everything already stated, before accepting the next request.
Create an inventory connector
A connector is the bridge to the systems holding location and stock data. Supported
auth_type values are API_KEY, OAUTH2_CLIENT_CREDENTIALS, and NONE.curl -X POST "https://api.facebook.com/{entity_id}/agent_connectors" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-H "X-API-Version: 2.0.0" \
-d '{
"name": "halloway_inventory_api",
"description": "Resolves a postcode to the nearest Halloway Hardware branch and reports live stock, pricing, and collection times for products at that branch.",
"base_url": "https://api.hallowayhardware.com/inventory/v2",
"auth_type": "OAUTH2_CLIENT_CREDENTIALS",
"auth_config": {
"oauth2_client_credentials": {
"token_url": "https://api.hallowayhardware.com/oauth/token",
"scopes_to_request": ["inventory.read", "locations.read"],
"client_id": "{YOUR_CLIENT_ID}",
"client_secret": "{YOUR_CLIENT_SECRET}"
}
}
}'
Save the
id from the response — the tools in Define connector tools are created under it, where it becomes the {connector_id} path parameter.The response carries a
connection_status object whose status is one of PENDING_OAUTH, ACTIVE, EXPIRED, or ERROR, with an error_message when the status is ERROR. ACTIVE means the configuration was accepted and stored. No token fetch happens at creation, so it does not confirm that token_url or base_url is reachable. Read it to confirm the connector was accepted, and to see OAuth states such as PENDING_OAUTH or EXPIRED as they surface later in its life:curl -X GET "https://api.facebook.com/{entity_id}/agent_connectors/{connector_id}" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "X-API-Version: 2.0.0"
Where else this applies. Inventory endpoints are usually the highest-traffic connector a commerce agent has, because they are called on almost every turn. Give them their own connector rather than folding them into an orders connector, so a slow inventory system does not hide behind a healthy overall success rate.
Define connector tools
Connector tools define the operations the agent can invoke. Each tool needs a
name, a description, user_auth_required, and a request_definition describing the outbound HTTP call. Inside request_definition, set method and path, then declare inputs in the section that matches where they belong: path_parameters for {placeholder} segments in the path, query_parameters, headers, or body.A
name can contain only letters, numbers, and underscores. Spaces, hyphens, and other punctuation are rejected. It also cannot start or end with an underscore, or contain two underscores in a row, so check_order_status is accepted while _check_order, check_order_, and check__order are not. The same rules apply to a connector’s name.This layer needs two tools, in a fixed order: resolve where the shopper is, then ask what is available there.
Resolve the fulfillment location
Everything downstream depends on this, so make it the cheapest possible call and make its description explicit that nothing else runs first.
curl -X POST "https://api.facebook.com/{entity_id}/agent_connectors/{connector_id}/tools" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-H "X-API-Version: 2.0.0" \
-d '{
"name": "resolve_location",
"description": "Converts a shopper postcode into the branch that will fulfill their order, and returns the branch name, its collection hours, and the delivery days available to that postcode. Call this before any stock, price, or delivery question, and call it again whenever the shopper gives a different postcode. If it returns no serviceable branch, tell the shopper the area is not currently served and do not check stock.",
"user_auth_required": false,
"request_definition": {
"method": "GET",
"path": "/locations/resolve",
"query_parameters": {
"postcode": {
"type": "string",
"description": "The shopper delivery or collection postcode, exactly as they gave it.",
"required": true
},
"customer_phone": {
"type": "string",
"description": "The shopper WhatsApp phone number, used to return a previously used branch when one exists.",
"binding": {
"kind": "macro",
"macro": "WHATSAPP_PHONE_NUMBER"
}
}
}
}
}'
Binding
customer_phone with the WHATSAPP_PHONE_NUMBER macro means the value comes from the conversation rather than from anything the agent composes. The full set of macros available to a binding is:| Macro | Value bound |
|---|---|
WHATSAPP_PHONE_NUMBER | The shopper’s WhatsApp phone number in full international form |
WHATSAPP_PHONE_NUMBER_NATIONAL | The same number in national form |
WHATSAPP_IDENTITY_HASH | A hashed identifier for the shopper |
WHATSAPP_CONVERSATION_ID | The current conversation identifier |
WHATSAPP_MESSAGE_ID | The identifier of the triggering message |
WHATSAPP_CURRENT_STATUS_ID | The current status identifier |
WHATSAPP_BSUID | The business-scoped user identifier |
USER_MESSAGE | The raw text of the shopper’s message |
Always validate a macro-bound value server-side. A binding controls what the agent can put in the field, not what reaches your endpoint.
Check stock at that location
curl -X POST "https://api.facebook.com/{entity_id}/agent_connectors/{connector_id}/tools" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-H "X-API-Version: 2.0.0" \
-d '{
"name": "check_stock",
"description": "Reports live availability at one branch for a list of SKUs, with the price at that branch, the quantity available, the earliest collection or delivery date, and a substitute SKU where one exists. Call this in the same turn you tell the shopper whether something is available. Requires a branch from resolve_location. Send the SKUs that share a requested quantity in one call. An item absent from the response is unavailable and must not be offered.",
"user_auth_required": false,
"request_definition": {
"method": "POST",
"path": "/stock/check",
"body": {
"content_type": "application/json",
"params": {
"branch_id": {
"type": "string",
"description": "The branch returned by resolve_location. Never guess this value or carry it over from a different postcode."
},
"skus": {
"type": "array",
"description": "The catalog SKUs to check, sent exactly as they appear in the catalog.",
"items": "{\"type\": \"string\", \"description\": \"A catalog SKU.\"}"
},
"quantity_required": {
"type": "integer",
"description": "How many units the shopper wants, when they have said. Availability for one unit does not imply availability for ten."
}
},
"required": ["branch_id", "skus"]
}
}
}'
Body fields list their required keys in
body.required. Array fields declare their element type with items, and its value is itself a JSON-encoded object describing the element rather than a bare type name — the bare form is rejected, and this is the part most easily got wrong.Return the quantity available, or availability evaluated against the requested
quantity_required, rather than only a boolean. “In stock” is true for one unit and false for the forty a trade customer wants, and an agent given only a flag will answer the wrong question confidently.Where a response is large or contains fields the agent should never see, connector tools accept a
transformation_spec that reshapes the payload before it reaches the agent. Trimming an inventory response to the handful of fields the conversation needs reduces both latency and the chance of the agent quoting an internal field at a shopper. See the Connector tools reference for the available step kinds.Where else this applies. The resolve-then-check pair generalizes to any availability question with a scope: a branch before appointment slots, a region before service coverage, a depot before parts. Keeping them as two tools rather than one lets the resolved scope persist across many checks in a conversation, which is both faster and much easier to reason about when something goes wrong.
Keep the catalog and inventory in step
The two systems drift, and the drift is invisible until a shopper hits it. Three failure modes account for most of it.
A SKU in the catalog that your inventory system does not recognize. The agent offers the product,
check_stock returns nothing for it, and the shopper is told an item on your own product list is unavailable. Reconcile the identifier sets on a schedule and treat unknown SKUs as an alert, not a log line.A SKU in inventory that is not in the catalog. The agent cannot offer it at all, so it is invisible. This one produces no errors anywhere and is only found by comparing counts.
A product still processing after a catalog update. Newly added products are not visible to the agent until processing completes. Confirm in Commerce Manager before announcing a range, rather than discovering it from a conversation.
Set the catalog
availability field from your inventory system on a slow cycle — daily is usually enough — so genuinely discontinued lines stop being offered. Do not try to drive it from live stock levels. It is a snapshot read at match time, it will lag whatever you write into it, and the live question is already answered properly by check_stock.Where else this applies. Any agent reading from a slow store and a fast store needs a reconciliation job between them, and the job needs to alert rather than log. Silent drift between a catalog and a system of record is one of the few problems that gets worse rather than louder over time.
Test the agent
Use Agent test to simulate shopper conversations before going live. Pass
conversation_id from a previous response to continue a multi-turn exchange.curl -X POST "https://api.facebook.com/{entity_id}/agent_test" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-H "X-API-Version: 2.0.0" \
-d '{
"user_msg": "Do you have the 18V combi drill in stock?"
}'
Cover these scenarios in your test plan:
| Scenario | Sample message |
|---|---|
Stock question with no postcode given | “Do you have the 18V combi drill?” |
Postcode supplied up front | “Do you have the 18V combi drill near SW1A 1AA?” |
Quantity beyond a single unit | “I need forty of the 25mm fixings” |
Item out of stock with a substitute | A SKU your test branch does not carry |
Item out of stock everywhere | A discontinued SKU still in the catalog |
Postcode changed mid-conversation | Ask about an item, then give a different postcode |
Unserviceable area | A postcode outside your delivery network |
Inventory endpoint unavailable | Point the tool at a failing host |
Catalog SKU unknown to inventory | A deliberately unreconciled identifier |
Variant ambiguity | “Do you have the drill?” where several variants exist |
The last four are the ones worth keeping as regressions. They are where an agent reaches for a plausible answer instead of admitting it does not have one.
Where else this applies. Test the unhappy paths of an availability layer far harder than the happy ones. A correct “yes, we have it” is unremarkable; an incorrect one turns into a wasted journey to a branch, and that is the failure shoppers tell other people about.
Example conversation
This exchange shows the configuration above in use: the agent resolves a location before answering, checks the quantity actually requested, offers a named substitute, and revalidates when the postcode changes.
Shopper: Do you have the 18V combi drill in stock?
Agent: I can check that. What is your postcode?
Shopper: M14 5RT
Agent:(calls
resolve_location, then check_stock)Yes — the 18V combi drill is available at 129.00 at our Rusholme branch. You can collect from 7am tomorrow, or take delivery on Thursday.
Shopper: Great, and do you have forty of the 25mm stainless fixings?
Agent:(calls
check_stock)Rusholme has twelve of the 25mm stainless fixings, so not enough for forty. The 25mm galvanised equivalent is in stock at ninety units, at 6.40 per pack of ten. Would that work?
Shopper: Actually deliver it all to WA14 2EP instead
Agent:(calls
resolve_location, then check_stock twice)That postcode is served by our Altrincham branch, so let me redo those. The 18V combi drill is 129.00 and available, delivery Thursday. The 25mm stainless fixings are available there in the quantity you need — forty units, 7.10 per pack of ten.
Monitor connector health
The connector logs endpoint reports how your inventory systems are answering the agent. It returns individual error entries by default, or aggregated failure patterns when
summary_only is true. Add include_stats=true for success rate and latency.curl -X GET "https://api.facebook.com/{entity_id}/agent_connectors/{connector_id}/logs?summary_only=true&top_n=5&include_stats=true" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "X-API-Version: 2.0.0"
Logs cover the last seven days, and the requested time range cannot exceed seven days. The response carries two objects:
| Object | Field | What it reports |
|---|---|---|
data | failure_code_name | The failure category |
data | error_message | The message returned by your endpoint |
data | tool_name | Which tool made the call |
data | occurrences | How many times this failure appeared |
stats | success_rate | Share of calls that succeeded |
stats | avg_latency_s | Mean round-trip time in seconds |
stats | p95_latency_s | 95th percentile round-trip time in seconds |
stats | p99_latency_s | 99th percentile round-trip time in seconds |
Filter to one operation with
tool_id when you want a single tool’s health rather than the connector’s overall rate. Because resolve_location and check_stock fail for quite different reasons — an unknown postcode against an inventory outage — look at them separately rather than at the connector total.Watch latency as closely as success rate. Both tools sit in front of nearly every substantive answer, so their combined round trip is what the shopper experiences as the agent’s speed.
Where else this applies. When one connector serves several tools with different call volumes, the aggregate success rate is dominated by the busiest one. A tool called rarely but critically can fail continuously without moving the overall number, which is a good reason to alert per tool rather than per connector.
Tips for this use case
These are the catalog and inventory decisions that most often go wrong once the agent is live.
Resolve location before anything else. Price, stock, and delivery all depend on it. An agent that answers before resolving will answer for the wrong place and sound completely certain.
Keep SKUs identical across systems. Map identifiers in your endpoint, never in an agent instruction. An agent asked to transform an identifier will eventually produce one that does not exist.
Answer the quantity question that was asked. Pass through how many units are wanted and return availability for that number. A boolean in-stock flag answers a question trade customers are not asking.
Let the tool omit what cannot be sold. An absent item is unambiguous. An item returned with a false flag invites the agent to mention it anyway.
Recheck everything after an address change. Every answer given before the change was scoped to a different location, and nothing in the conversation makes that visible to the shopper.
Do not drive catalog
availability from live stock. It lags, it is read as a snapshot, and it will contradict check_stock. Use it for discontinued lines and nothing more.Reconcile catalog and inventory on a schedule, with alerting. Both drift directions are silent. One produces items the agent offers but cannot sell; the other produces items you sell but the agent never mentions.
Set
item_group_id on everything with variants. Otherwise the agent checks stock on a variant the shopper did not mean and reports it as the answer.Trim the inventory response. Send the agent the fields the conversation needs. A large payload is slower and gives the agent more opportunities to quote something internal.
Summary checklist
Confirm each of the following before you enable the agent on a production phone number.
- Linked a Meta product catalog owned by the same business and confirmed processing is complete
- Decided which values live in the catalog and which come from the connector, and written it down
- Set
item_group_idon every product with variants - Confirmed catalog SKUs match the identifiers your inventory system accepts
- Added a
stock-and-availabilityinstruction that requires location resolution before any availability answer - Instructed the agent to recheck all prior items after a postcode change
- Created an inventory connector, confirmed it was accepted, and proved the endpoint is reachable with a real tool call
- Defined
resolve_locationandcheck_stockas separate tools - Bound the shopper phone number with the
WHATSAPP_PHONE_NUMBERmacro and validated it server-side - Made
check_stockaccept a quantity and answer for that quantity - Made
check_stockomit unavailable items rather than flagging them - Scheduled a catalog-to-inventory reconciliation job that alerts on unmatched SKUs
- Tested missing postcodes, quantity shortfalls, substitutions, address changes, and inventory outages
- Set up per-tool connector health monitoring with alerting on latency as well as failures