Skip to main content
A food delivery order starts with a choice of store. The shopper asks for tacos, and Agentcard answers with the taco places near them that deliver. Your chat shows a card for each store, with its picture, its name and its delivery time. The shopper taps one, and the next cards are that store’s menu.

Render a card for each store

Send the shopper’s words with the address to deliver to, such as get me tacos delivered to 1 Market St, San Francisco, CA 94105. The answer lists the stores its reply names, up to eight, in the order the reply names them. Show each store as a card with its picture, its name, its delivery time and an Order here button. The reply already asks which store in one short line, so show it under the cards. Agentcard lists stores only for an answer that offers the shopper a choice of stores. An answer that searched stores on its way to a menu, or one that shows a cart, lists none. A later answer that offers the stores again lists them again, so every store the reply names arrives with its card.
Each store reaches sendLink as a link of kind store:
chat.ts
result.stores carries the same stores for your code, each with its url and linkSent. The model reads each store by its store_id, name and eta_minutes, never its page, and reads store_links_sent, the number of store cards the shopper holds. A store link that your sendLink throws on counts as not sent.

Pick a store

When the shopper taps a card, send the store’s id back with their words, such as Order from Suavecito Birria & Tacos. Agentcard selects exactly that store before it answers and runs no new store search, so the next answer is that store’s menu. The shopper can also pick in their own words, with no id. Agentcard reads the store’s name, the name with please, and order here or this place as a pick of a store the last answer listed. An answer of only a place in the list, such as the second one or 2, picks the store at that place. A dish beside the store’s name is a search, not a pick: order tacos from el farolito searches for tacos.
When the shopper picks a store, the model passes that store_id. The Order here button can send the shopper’s words alone, and the tool reads them as a pick, so a tap needs no id from your app. Your own code can pick too, with buy.answer and the link’s storeId:
store-button.ts
result.store_pick says what happened: the store’s id and name, and selected, whether the merchant took the selection. When it did not, Agentcard selects the store while it writes its answer. The model reads the same store_pick.A pick starts no search, so it gets no instant reply. Acknowledge the shopper shows how your chat can still react.

Handle a store no longer listed

Agentcard keeps the stores of a search for 15 minutes, and a newer search replaces them. A pick of a store Agentcard no longer keeps selects nothing. Send the shopper’s words again without the store’s id, and Agentcard searches again.
The model reads that the pick selected nothing and that it should search again with the shopper’s words.

Show the menu

The menu arrives as products, one for each dish, with the same fields as any product. The dishes of one store share the store’s one page, so three dishes are three cards that open the same page. Render them as Show products shows, and put the one the shopper taps in the cart.
The dishes reach sendLink as links of kind product.

Check it in the sandbox

The sandbox, Agentcard’s test mode, searches real stores and stops before payment, so no order is placed.
  1. As a test shopper, send get me tacos delivered to 1 Market St, San Francisco, CA 94105.
  2. Check that stores arrive, each with a name, and that the reply asks which store.
  3. Pick the second store by its id. Check that the next answer is that store’s dishes and that no new store search ran.
  4. After a new store search, send the second one. Check that the second store is selected.
  1. Check that each store card has a picture and a delivery time.
DoorDash asks the shopper to sign in to their own account before checkout, as Send each link shows.