Order food, groceries, and convenience items from DoorDash using the built-in CLI integration
You can order food from DoorDash for the user using the DoorDash CLI script.
IMPORTANT: Always use host_bash (not bash) for all DoorDash commands. The DoorDash CLI needs host access for Chrome CDP and session cookies - none of which are available inside the sandbox.
The DoorDash CLI is invoked via bun {baseDir}/scripts/doordash-entry.ts. Do NOT search for the script, inspect it, or try to discover how the CLI works. Just run the commands as documented below.
A task progress card is shown automatically when you run your first DoorDash command. Its surface ID is doordash-progress. As each step completes, call ui_update with surface ID doordash-progress to update step statuses. Update data.templateData.steps - set completed steps to "status": "completed" with a "detail" string, the current step to "status": "in_progress", and future steps to "status": "pending". Adapt the steps to the actual flow (e.g. skip "Search restaurants" if the user named a specific store).
When the user asks you to order food (e.g. "Order pizza from Andiamo's"):
Check session - run bun {baseDir}/scripts/doordash-entry.ts status --json. If loggedIn is false or the session is expired, tell the user: "A Chrome window will open to the DoorDash login page. Please sign in there - I'll detect your login automatically and minimize the window." Then run bun {baseDir}/scripts/doordash-entry.ts refresh --json. This captures your session automatically and auto-stops once it detects you've signed in. The session is imported automatically. This command blocks until login is complete - just wait for it.
Keep the DoorDash Chrome window open in the background - it's needed for API requests.
Search - run bun {baseDir}/scripts/doordash-entry.ts search "<query>" --json to find matching restaurants. Present the top results to the user with name, rating, and delivery info. If the user named a specific restaurant, pick the best match. If ambiguous, ask.
Browse menu - run bun {baseDir}/scripts/doordash-entry.ts menu <storeId> --json to get the menu. Show the user the categories and items with prices. If the user already said what they want (e.g. "pepperoni pizza"), find the matching item(s). For convenience/pharmacy stores (CVS, Duane Reade, Walgreens etc.), the response will have isRetail: true and empty items - use store-search instead (see step 3b).
3b. Search within a retail store - for convenience/pharmacy stores, run bun {baseDir}/scripts/doordash-entry.ts store-search <storeId> "<query>" --json to find specific products. This returns items with IDs, prices, and menuIds that can be added to cart directly.
Get item details (if needed) - run bun {baseDir}/scripts/doordash-entry.ts item <storeId> <itemId> --json to see options/customizations. The response includes:
options: each option group has minSelections/maxSelections indicating how many choices are requiredunitAmount (price impact in cents), defaultQuantity, and possibly nestedOptions (sub-choices like milk type within a size selection)specialInstructionsConfig: whether special instructions are accepted, max length, and placeholder textIf the item has required options (like size or toppings), construct the nestedOptions JSON from the option/choice IDs and pass it via --options. Ask the user for preferences or pick sensible defaults.
Add to cart - run bun {baseDir}/scripts/doordash-entry.ts cart add --store-id <id> --menu-id <id> --item-id <id> --item-name "<name>" --unit-price <cents> [--options '<json>'] [--special-instructions "<text>"] --json. For subsequent items at the same store, pass --cart-id <id> from the first add response. Use --special-instructions for requests like "extra hot", "no ice", etc. Use --options to pass customization choices (see Customization Options below).
Review cart - run bun {baseDir}/scripts/doordash-entry.ts cart view <cartId> --json and show the user what's in their cart with prices. Ask if they want to add anything else or proceed.
Checkout - run bun {baseDir}/scripts/doordash-entry.ts checkout <cartId> --json to get delivery options. Present them to the user.
Payment methods - run bun {baseDir}/scripts/doordash-entry.ts payment-methods --json to see saved cards. Show the user which card will be used (the default one).
Place order - after the user explicitly confirms, run bun {baseDir}/scripts/doordash-entry.ts order place --cart-id <id> --store-id <id> --total <cents> [--tip <cents>] [--dropoff-option <id>] --json. The command auto-selects the default payment method if --payment-uuid is not provided. The response contains orderUuid on success.
"error": "session_expired", run bun {baseDir}/scripts/doordash-entry.ts refresh --json to re-capture the session.--json flag on all commands for reliable parsing.cart add calls. If you get a 403 error, wait 15–20 seconds and retry. For large orders (5+ items), consider running bun {baseDir}/scripts/doordash-entry.ts refresh --json midway through if you hit repeated 403s.--options for customizations (size, milk type, etc.). Only use --special-instructions for free-text requests that aren't covered by the item's option groups. If the merchant rejects special instructions, drop them and proceed without.cart add with --options fails, or if the item details show options that are hard to construct (deeply nested, unusual format), proactively offer to use cart learn so the user can customize the item visually in the browser. Don't silently drop customizations - tell the user what happened and offer alternatives.bun {baseDir}/scripts/doordash-entry.ts record to capture fresh queries before assuming the schema changed.Many items (especially coffee, boba, sandwiches) have required customization options like size, milk type, or toppings. Here's how to handle them:
bun {baseDir}/scripts/doordash-entry.ts item <storeId> <itemId> --json to get the item's option groupsid, name, required, minSelections, maxSelections, and choices[
{
"optionId": "<option-group-id>",
"optionChoiceId": "<choice-id>",
"quantity": 1,
"nestedOptions": []
}
]
For choices with nested sub-options (e.g., selecting "Oat Milk" under the "Milk" option within a size), add them to the nestedOptions array of the parent choice.
cart add --options '<json>'Use --special-instructions on cart add for free-text requests like "extra hot", "no ice", "light foam". The item command response includes specialInstructionsConfig with the max length and whether instructions are supported.
Warning: Some merchants disable special instructions entirely. If specialInstructionsConfig.isEnabled is false, or if the add-to-cart call returns an error about special requests, drop the instructions and retry without them. Always prefer --options for customizations - special instructions are a last resort for requests not covered by the item's option groups.
For complex items where constructing the JSON manually is difficult, use cart learn:
bun {baseDir}/scripts/doordash-entry.ts cart learn --jsonupdateCartItem operation and extracts the exact nestedOptions and specialInstructionscart add --options '<json>'You can also extract options from an existing recording with bun {baseDir}/scripts/doordash-entry.ts inspect <recordingId> --extract-options --json.
User: "Order a large oat milk latte with an extra shot from Blue Bottle"
bun {baseDir}/scripts/doordash-entry.ts search "Blue Bottle" --json -> finds storebun {baseDir}/scripts/doordash-entry.ts menu <storeId> --json -> finds "Latte" itembun {baseDir}/scripts/doordash-entry.ts item <storeId> <latteItemId> --json -> returns options:
bun {baseDir}/scripts/doordash-entry.ts cart add --store-id <id> --menu-id <id> --item-id <id> --item-name "Latte" --unit-price 550 --options '[{"optionId":"size-group-id","optionChoiceId":"103","quantity":1,"nestedOptions":[]},{"optionId":"milk-group-id","optionChoiceId":"202","quantity":1,"nestedOptions":[]},{"optionId":"extras-group-id","optionChoiceId":"301","quantity":1,"nestedOptions":[]}]' --special-instructions "Extra hot" --json
bun {baseDir}/scripts/doordash-entry.ts status --json # Check if logged in
bun {baseDir}/scripts/doordash-entry.ts refresh --json # Capture fresh session (auto-stops after login)
bun {baseDir}/scripts/doordash-entry.ts logout --json # Clear session
bun {baseDir}/scripts/doordash-entry.ts search "<query>" --json # Search restaurants
bun {baseDir}/scripts/doordash-entry.ts menu <storeId> --json # Get store menu (auto-detects retail stores)
bun {baseDir}/scripts/doordash-entry.ts store-search <storeId> "<query>" --json # Search items within a convenience/pharmacy store
bun {baseDir}/scripts/doordash-entry.ts item <storeId> <itemId> --json # Get item details + options
bun {baseDir}/scripts/doordash-entry.ts cart add --store-id <id> --menu-id <id> --item-id <id> --item-name "<name>" --unit-price <cents> [--quantity <n>] [--cart-id <id>] [--options '<json>'] [--special-instructions "<text>"] --json
bun {baseDir}/scripts/doordash-entry.ts cart remove --cart-id <id> --item-id <orderItemId> --json
bun {baseDir}/scripts/doordash-entry.ts cart view <cartId> --json
bun {baseDir}/scripts/doordash-entry.ts cart list [--store-id <id>] --json
bun {baseDir}/scripts/doordash-entry.ts cart learn --json # Learn customization options by recording browser interaction
bun {baseDir}/scripts/doordash-entry.ts inspect <recordingId> --extract-options --json # Extract nestedOptions from a recording
bun {baseDir}/scripts/doordash-entry.ts checkout <cartId> [--address-id <id>] --json
bun {baseDir}/scripts/doordash-entry.ts payment-methods --json # List saved payment methods
bun {baseDir}/scripts/doordash-entry.ts order place --cart-id <id> --store-id <id> --total <cents> [--tip <cents>] [--delivery-option <type>] [--dropoff-option <id>] [--payment-uuid <uuid>] --json
User: "Order a pepperoni pizza from Andiamo's"
bun {baseDir}/scripts/doordash-entry.ts status --json -> logged inbun {baseDir}/scripts/doordash-entry.ts search "Andiamo's" --json -> finds store 22926474bun {baseDir}/scripts/doordash-entry.ts menu 22926474 --json -> finds "Pepperoni Pizza Pie" (item 2956709006, $28.00)bun {baseDir}/scripts/doordash-entry.ts cart add --store-id 22926474 --menu-id 12847574 --item-id 2956709006 --item-name "Pepperoni Pizza Pie" --unit-price 2800 --jsonbun {baseDir}/scripts/doordash-entry.ts cart view <cartId> --json -> show summaryUser: "I need Tylenol from CVS"
bun {baseDir}/scripts/doordash-entry.ts status --json -> logged inbun {baseDir}/scripts/doordash-entry.ts search "CVS" --json -> finds store 1231787bun {baseDir}/scripts/doordash-entry.ts menu 1231787 --json -> isRetail: true, categories but no itemsbun {baseDir}/scripts/doordash-entry.ts store-search 1231787 "tylenol" --json -> finds resultsid, menuId, and unitAmount