Single item purchase agent
Updated: Sep 18, 2026
Copy for LLM
Online and multichannel retailers can use Meta Business Agent to complete a single-item sale over WhatsApp — helping a shopper narrow down to one product, confirming the variant they actually want, checking that it is in stock right now, and placing the order. This page covers the agent instructions, knowledge sources, and connector configuration for that scenario. At minimum you must add one agent instruction and create a connector with a
check_stock and a create_order tool; your product catalog, FAQs, and website crawl improve the conversation but the agent cannot confirm stock or sell without the connector.The agent handles:
- Product discovery across your Meta product catalog
- Variant resolution, establishing size and color before anything is quoted
- Live stock checks for a specific variant, not a general in-stock flag
- Order placement, with shopper confirmation before the order is created
- Order lookups for a purchase the shopper already made
- Out-of-scope questions — returns in progress, payment disputes, damaged deliveries — routed to your support team
Who this guide is for
The examples use an outdoor equipment retailer, but the configuration pattern fits any business selling one item the buyer keeps, bought outright in a single exchange: the shopper picks a product and a variant, pays once, and the item ships.
| Organization type | What the agent presents | What the agent submits |
|---|---|---|
Apparel and footwear retailers | Products with size and color variants | A single-line order |
Outdoor, sports, and hobby retailers | Products with technical specifications | A single-line order |
Consumer electronics retailers | Models with capacity or configuration variants | A single-line order, often with a warranty option |
Homeware and furniture retailers | Items with finish and dimension variants | An order with a delivery slot |
Direct-to-consumer brands | A short product range with few variants | A single-line order |
This flow differs from a rental or a booking. There is no date range, availability means “this exact variant is in the warehouse now” rather than “free between two dates”, and the shopper keeps the item. It also differs from a cart-based checkout: the agent commits one line, not a basket the shopper assembles across several turns. If you rent time-bounded use of a limited fleet, see Booking and reservation agent. If your conversation ends in a qualified handoff rather than a payment, see Lead generation agent.
Each step below notes how the API is used in other scenarios, then applies it to the retail example.
Prerequisites
Have the following in place before you configure the agent for single-item sales. The first three come from Meta Business Agent onboarding; the fourth and fifth are your own systems.
- 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_messagingandwhatsapp_business_managementpermissions — see Generate an access token.whatsapp_business_messagingauthenticates your requests;whatsapp_business_managementis required to read agent data, such as connector logs - 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 publicly accessible HTTPS endpoint for your commerce or order management system, required by Create a commerce connector
- A staffed destination for handed-off conversations, required by Configure handoff
Add agent instructions
Agent instructions shape how the agent responds. The
title is a short identifier, description tells the agent when to apply the instruction, and skill contains the actual instructions.Note: An instructiontitlecan be up to 64 characters — lowercase letters, numbers, and dashes only, and cannot start or end with a dash.
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": "product-sales",
"description": "Applied when shoppers ask about products, sizing, colors, stock, prices, delivery timing, or want to buy something.",
"skill": "Help shoppers find the right product from what they describe, such as the activity, the conditions, or who it is for, not only from product names. Establish the exact variant, including size and color, before checking stock or quoting a price. Never state that an item is in stock, or quote a price, that did not come from a tool call. Present one clear recommendation with a short reason rather than listing the whole range. Confirm the product, the variant, and the total with the shopper before creating an order. If the requested variant is out of stock, say so and offer the closest available alternative from the same product group. For returns already in progress, payment disputes, and damaged deliveries, acknowledge the request and direct the shopper to the support team."
}'
Each POST call creates one instruction. The instruction to resolve the variant before checking stock matters more in retail than in most scenarios, because stock is held per variant and a “yes, we have it” against the wrong size is the most common way this flow disappoints a shopper.
Where else this applies. An agent instruction is scoped, so the same call shapes very different agents. An electronics retailer can require the storage capacity before quoting, and a furniture retailer can require the finish and the room dimensions. For a single-item sale, keep the instruction focused on variant resolution, tool-sourced stock and price, and explicit confirmation before the order is created.
Add product FAQs
FAQs give the agent reliable answers to common questions. Each entry takes a
question and an answer, both required. Focus on policies that change only when you change them.curl -X POST "https://api.facebook.com/{entity_id}/agent_config/faq" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-H "X-API-Version: 2.0.0" \
-d '{
"question": "What is your returns policy?",
"answer": "You have 60 days from delivery to return an unused item in its original packaging with tags attached. Returns are free using the prepaid label in your dispatch email. Refunds reach the original payment method within 5 to 7 working days of the item arriving at the warehouse. Worn or washed items can only be returned under the warranty process."
}'
Manage existing entries with the following calls:
| To do this | Call |
|---|---|
Retrieve all entries | GET /{entity_id}/agent_config/faq |
Replace one entry | PUT /{entity_id}/agent_config/faq/{faq_id} |
Remove one entry | DELETE /{entity_id}/agent_config/faq/{faq_id} |
A PUT replaces the whole entry, so send both
question and answer even when only one changed.Suggested FAQs for a retail scenario:
| Question | Notes |
|---|---|
What is your returns policy? | Window, condition required, who pays postage, refund timing |
How long does delivery take? | Standard and express options, cutoff time for same-day dispatch |
How much is delivery? | Thresholds for free delivery, and any surcharge for remote areas |
How do I choose the right size? | Whether the range runs large or small, and where the size guide is |
Do you ship internationally? | Countries served, duties, and typical transit times |
What warranty comes with the product? | Length, what it covers, and how to make a claim |
Can I change or cancel my order? | The window before dispatch, and what happens after |
Do you price match? | Whether you do, against whom, and what evidence is needed |
Where else this applies. FAQs suit any question whose answer changes only when a policy changes: an electronics retailer is asked about warranty length, a furniture retailer about assembly. Anything that changes on its own — whether a size is in stock, what an item costs during a sale — belongs in a connector tool instead.
Set up your product catalog
Meta Business Agent draws product information from your Meta product catalog, which you manage in Meta Commerce Manager rather than through this API. There is no catalog call to make from your integration: once the catalog is linked to the business, the agent already knows the products in it. See Product catalog in Get started.
What matters for this scenario is how that catalog is structured, because variant resolution depends on it entirely. Retail is the case the catalog fields were designed around, so use them rather than pushing detail into the product description.
| Catalog practice | Why it matters for a single-item sale |
|---|---|
One item per sellable variant | The agent matches and orders a variant, not a product. Sizes listed inside one description cannot be matched reliably |
Group variants under a shared item group | This is what lets the agent offer a different size or color when the requested one is out of stock |
Keep the retailer SKU aligned with your commerce system | The SKU is what ties a catalog item to the live stock check and the order, so the two systems must agree |
Fill the variant attributes | Size, color, gender, age group, material, and pattern are matched directly. Anything only in the description is matched as prose |
Write the description for what shoppers ask about | Conditions it suits, weight, what it does not do. This is where the agent finds the answer to “will this work for hiking in Scotland” |
Treat availability as whether you list the variant | Not whether it is in the warehouse right now. That comes from check_stock |
Include an image and a product URL | Gives the shopper something to look at before deciding |
Where else this applies. Any business with a browsable inventory works this way, and the structural decision is the same everywhere: granularity. One catalog item per sellable variant sharing an item group makes discovery slightly more work to set up and variant resolution far more reliable. The coarse alternative, one item per product with variants described in prose, is the single most common cause of an agent confirming the wrong thing.
Crawl your help center
The Websites knowledge source crawls your public website so the agent can answer from pages that are not product listings — size guides, care and washing instructions, delivery information by country, and terms of sale.
curl -X POST "https://api.facebook.com/{entity_id}/agent_config/websites" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-H "X-API-Version: 2.0.0" \
-d '{
"url": "https://www.kestrelsupply.com/help"
}'
Website knowledge is a snapshot taken at crawl time. Poll
GET /{entity_id}/agent_config/websites/{website_id} until crawl_status reports the crawl finished, and re-crawl whenever those pages change materially.Where else this applies. Crawling suits content that already exists on your public site and changes on a predictable cycle: a size guide, a care instruction library, a delivery matrix. For retail, crawl the help and size-guide pages rather than the product listing pages, since your Meta product catalog already carries product data in a structured form the agent handles better.
Create a commerce connector
A connector is the bridge to your commerce or order management system. 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": "kestrel_commerce_api",
"description": "Checks live stock and price for a product variant, creates single-item orders, and returns order status for Kestrel Supply Co.",
"base_url": "https://api.kestrelsupply.com/commerce/v2",
"auth_type": "API_KEY",
"auth_config": {
"api_key": {
"headers": [
{
"field_name": "X-API-Key",
"value": "{YOUR_COMMERCE_API_KEY}"
}
]
}
}
}'
A successful response returns the
id of the new connector. Save it — the tools in Define connector tools are created under it, where it becomes the {connector_id} path parameter.Where else this applies. The connector call is identical whichever system holds your live state. Only
base_url, auth_type, and the credentials change. For retail, point it at the service that owns stock and orders, because those are the two facts the agent must never guess.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.A single-item sale needs three tools: one to check stock and price for a variant, one to place the order, and one to answer questions about an order already placed.
Check stock for a variant
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": "Returns live stock and the current price for one product variant, plus the other variants of the same product that are available. Call this before telling a shopper an item is available and before quoting any price. Ask for the size and color first if either is missing.",
"user_auth_required": false,
"request_definition": {
"method": "GET",
"path": "/stock",
"query_parameters": {
"item_group_id": {
"type": "string",
"description": "The product group code, for example KS-FELL-JKT.",
"required": true
},
"size": {
"type": "string",
"description": "The size the shopper asked for, for example M. Omit only when the product has no size variants."
},
"color": {
"type": "string",
"description": "The color the shopper asked for, for example Slate. Omit when the shopper has no preference."
},
"postcode": {
"type": "string",
"description": "Delivery postcode, used to return an accurate delivery estimate. Omit when the shopper has not given one."
}
}
}
}'
Returning the sibling variants in the same response is what lets the agent offer an alternative in one turn instead of guessing and checking again.
Create an order
The shopper’s phone number identifies their order, and it is a value the agent should never have to ask for or infer. Bind it with the
WHATSAPP_PHONE_NUMBER macro so Meta Business Agent fills it at runtime.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": "create_order",
"description": "Places an order for one product variant and returns the order number and total. Call this only after the shopper has confirmed the exact variant and the total, and after check_stock reported the variant available. Do not call it to check a price or stock.",
"user_auth_required": false,
"request_definition": {
"method": "POST",
"path": "/orders",
"body": {
"content_type": "application/json",
"params": {
"sku": {
"type": "string",
"description": "The variant code the shopper confirmed, as returned by check_stock."
},
"quantity": {
"type": "integer",
"description": "Number of units. Use 1 unless the shopper explicitly asked for more."
},
"delivery_postcode": {
"type": "string",
"description": "The delivery postcode the shopper gave."
},
"delivery_speed": {
"type": "string",
"description": "Either standard or express, as the shopper chose. Default to standard when they did not say."
},
"customer_phone": {
"type": "string",
"description": "The shopper WhatsApp phone number, used to identify the order.",
"binding": {
"kind": "macro",
"macro": "WHATSAPP_PHONE_NUMBER"
}
}
},
"required": ["sku", "quantity", "delivery_postcode", "customer_phone"]
}
}
}'
Check an order
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_order_status",
"description": "Returns the status, item, and expected delivery date for one order. Call this when a shopper asks about an order they already placed. Ask for the order number first if they did not provide one. The call must fail when the order number does not belong to the customer phone number.",
"user_auth_required": false,
"request_definition": {
"method": "GET",
"path": "/orders/{order_id}",
"path_parameters": {
"order_id": {
"type": "string",
"description": "The order number as the shopper provided it, for example KS-771204."
}
},
"query_parameters": {
"customer_phone": {
"type": "string",
"description": "The shopper WhatsApp phone number, used to confirm the order belongs to them.",
"required": true,
"binding": {
"kind": "macro",
"macro": "WHATSAPP_PHONE_NUMBER"
}
}
}
}
}'
Path parameters are always required, so they take no
required flag. Body fields list their required keys in body.required. The customer_phone query parameter carries the bound WhatsApp number so your backend can reject an order number that does not belong to the shopper — that is what makes the “someone else’s reference” test case fail instead of leaking another shopper’s order.Where else this applies. Retail flows share this resolve, verify, commit shape: narrow to one variant, confirm it exists right now, then take the money. An electronics retailer swaps size and color for capacity and finish. Guard the write in every case, since it is the call that charges a card when the agent gets it wrong.
Configure handoff
The
product-sales instruction tells the agent to route returns already in progress, payment disputes, and damaged deliveries to your team. That instruction does nothing on its own. Pair it with a real destination, or the customer is acknowledged and then left waiting.Two pieces are involved, and both are required.
Set the handoff policy on the agent with Agent settings, which controls how the agent behaves when a conversation should move to a person.
Transfer the conversation itself with Thread control (Cloud API). Thread control decides who owns the thread: while your app holds control, the agent stops responding and your team answers directly in the same WhatsApp conversation. Pass control back when the case is closed.
curl -X PUT "https://api.facebook.com/{entity_id}/agent_config/settings" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "X-API-Version: 2.0.0" \
-H "Content-Type: application/json" \
-d '{
"handoff": {
"enabled": true,
"message_selection": "AGENT"
}
}'
Take control when a shopper escalates
Thread control is a single POST with an
action. take acquires control from the
current owner, which stops the agent responding so your team can answer in the same
conversation. It is restricted to the escalation partner configured on the phone number.Note the path parameter is named
phone_number_id here rather than entity_id. It is
the same WhatsApp Business phone number ID used everywhere else in this guide.curl -X POST "https://api.facebook.com/business/whatsapp/phone_numbers/{phone_number_id}/thread_control" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"action": "take",
"to": "{SHOPPER_PHONE_NUMBER}",
"metadata": "Damaged delivery on order KS-771204"
}'
metadata is a free-form string forwarded verbatim to the receiving app in the
resulting messaging_handovers webhook. Use it to carry the order number, so the colleague
picking the conversation up does not have to ask for it again.Hand the conversation back
When the case is closed,
release relinquishes control and makes Meta Business Agent
the automatic responder again. You must currently hold thread control for this to
succeed.curl -X POST "https://api.facebook.com/business/whatsapp/phone_numbers/{phone_number_id}/thread_control" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"action": "release",
"to": "{SHOPPER_PHONE_NUMBER}"
}'
The three actions differ in who ends up holding the thread:
| Action | Effect | Who can call it |
|---|---|---|
take | Acquires control from the current owner. The agent stops responding | The configured escalation partner |
release | Relinquishes control and restores the agent as automatic responder | Whoever currently holds control |
pass | Transfers control to the agent when control_pass.target_role is ai_agent, or to the configured escalation partner when control_pass is omitted | Whoever currently holds control |
These calls take
X-API-Version: 1.0.0 if you send it, not the 2.0.0 used by every other call on this page, and the header is optional — the examples omit it.
Thread control belongs to the Cloud API rather than the agent configuration API: its
version header is optional and accepts only 1.0.0, so the 2.0.0 value used
elsewhere in this guide does not apply here.This endpoint needs the
whatsapp_business_messaging permission, the same one used for
the rest of this guide.These arrive on a sales line constantly, because the shopper does not distinguish between the channel that sold them the item and the channel that supports it. The agent configured here can take an order but has no tools for a refund, a replacement, or a lost parcel, so it should recognize those and move them on rather than improvise.
Decide what happens outside staffed hours before you launch. An agent that hands off at 02:00 into an unstaffed queue produces a worse outcome than one that says when the team is next available.
Where else this applies. Any agent that can take money will also receive the problems that follow it. Decide early whether those conversations hand off to a person or route to a separate support agent, and configure the destination either way. For a dedicated support configuration, see Customer support agent.
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": "I need a waterproof jacket for hiking in Scotland in April"
}'
Cover these scenarios in your test plan:
| Scenario | Sample message |
|---|---|
Vague discovery | “I need something waterproof for hiking” |
Missing variant | “How much is the Fellside jacket?” |
Out-of-stock variant | “Do you have the Fellside in a large?” |
Alternative offer | “What else have you got in a large?” |
Sizing question | “I’m normally a 40 inch chest, what size is that?” |
Purchase | “I’ll take the medium in slate” |
Order lookup | “Where is order KS-771204?” |
Someone else’s reference | “Where is order KS-000001?” (expect failure, not a lookup) |
Price question during a sale | “Is the Fellside discounted at the moment?” |
Out-of-scope question | “My jacket arrived with a hole in it” |
Where else this applies. Test the transaction your agent actually completes, in the words your shoppers use rather than the terms in your catalog. Always include one out-of-stock variant, because handling that gracefully is the difference between a saved sale and an abandoned conversation, and one message that should hand off.
Example conversation
This exchange shows the configuration above in use: the agent resolves the variant before checking anything, calls
check_stock before quoting, offers an alternative when the requested size is unavailable, and confirms before calling create_order.Shopper: Hi, I need a waterproof jacket for hiking in Scotland in April.
Agent: The Fellside 3-season shell is the one most people take for that — three-layer waterproof, taped seams, and it packs down to 310 grams. It is not insulated, so you would layer underneath on colder days. What size do you usually take, and do you have a color preference?
Shopper: Large, and slate if you have it.
Agent:(calls
check_stock)The large in slate is out of stock at the moment, but the large in moss is available at £189.00. Would the moss work for you?
Shopper: Moss is fine. I’ll take it.
Agent: Just to confirm — Fellside 3-season jacket, large, moss, £189.00 with free standard delivery. What is your delivery postcode?
Shopper: Yes, that’s right. My postcode is EH1 1YZ.
Agent:(calls
create_order)Ordered — Fellside 3-season jacket, large, moss, £189.00 to EH1 1YZ. Your order number is KS-771204.
Monitor connector health
The connector logs endpoint,
GET /{entity_id}/agent_connectors/{connector_id}/logs, reports how your commerce system is 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.Reading these logs requires the
whatsapp_business_management permission in addition to whatsapp_business_messaging. A token with only whatsapp_business_messaging receives a 200 response with an empty body.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. Each entry in
data is one error event by default, or one failure pattern when you pass summary_only=true, and stats summarizes the whole window. For the fields each mode returns, see the Connectors reference.Filter to one operation with
tool_id when you want a single tool’s health rather than the connector’s overall rate.Where else this applies. Watch the write tool separately from the connector as a whole, because a healthy overall rate hides a write that fails every time when reads outnumber writes. For retail,
check_stock latency deserves its own attention: it sits in the middle of every conversation, and a slow stock check is felt as a slow agent even when nothing has failed.Tips for this use case
These are the retail specific decisions that most often go wrong once the agent is live.
One catalog item per sellable variant. Sizes listed inside a description cannot be matched reliably. Give each variant its own item in Commerce Manager, with the variant attributes filled and a shared item group, and the agent resolves what the shopper wants in one turn.
Return sibling variants from the stock check. An out-of-stock answer that also carries the available alternatives lets the agent save the sale immediately. Without them it has to guess a second variant and check again, and shoppers leave during that round trip.
Keep the catalog for discovery and the connector for truth. The catalog tells the agent which products exist and how to describe them. Stock and the live price should come from
check_stock, so a stale catalog price never becomes a quoted total.Bind the shopper’s phone number rather than asking for it. The
WHATSAPP_PHONE_NUMBER macro fills the value at runtime, which removes a turn from the conversation and a chance for the agent to transcribe it wrong.Gate order creation behind explicit confirmation of the variant and the total. This is the call that takes money. The
create_order description tells the agent to confirm first. Test that boundary with ambiguous messages such as “yeah go on then” and confirm the agent restates the variant rather than assuming.Decide where payment happens before you launch. This flow creates an order and leaves payment to your existing checkout or to an invoice. If you want payment captured in the conversation, that is a separate integration and should be designed before go-live, not retrofitted.
Set quantity deliberately. A single-item flow should default to one unit. Leaving quantity open invites the agent to interpret “a couple” as two when the shopper meant “a couple of options”.
Summary checklist
Confirm each of the following before you enable the agent on a production phone number.
- Added a
product-salesagent instruction scoped to variant resolution, confirmation, and handoff - Added FAQs for stable policies (returns, delivery, sizing, warranty)
- Structured the Meta product catalog with one item per sellable variant, variant attributes filled, and variants sharing an item group
- Crawled the help and size-guide pages of your website
- Created a commerce connector with API key authentication
- Defined
check_stock,create_order, andcheck_order_statusconnector tools - Configured
check_stockto return sibling variants alongside the requested one - Bound the shopper phone number with the
WHATSAPP_PHONE_NUMBERmacro and validated it server-side - Tested vague discovery, missing variants, out-of-stock variants, alternatives, purchase, and out-of-scope questions
- Configured a handoff policy in agent settings and implemented thread control for post-sale problems
- Set up connector health monitoring with alerting on the write tool and on stock check latency