Scrape Instacart order history via browser to get full itemized details (names, quantities, prices). Use when an Instacart order has missing items, or when asked to backfill order history.
Extracts full itemized order details from Instacart via browser automation. The email scanner detects Instacart orders but emails rarely contain item lists — this skill fills them in by scraping the Instacart account.
Check for Instacart orders with empty or missing items:
sqlite3 ~/.config/spratt/orders/orders.sqlite \
"SELECT id, order_id, order_date, items, total FROM orders WHERE source = 'instacart' AND (items = '[]' OR items = '' OR json_array_length(items) = 0) ORDER BY order_date DESC;"
If no orders need filling, stop here.
openclaw browser navigate "https://www.instacart.com/store/account/orders"
openclaw browser snapshot --format ai
This returns a list of past orders with:
/store/orders/ORDER_IDMatch orders from the database (by date + approximate total) to find the right detail URL.
From the order detail page, find the "Receipt" link. Navigate to it:
openclaw browser navigate "RECEIPT_URL"
openclaw browser snapshot --format ai
The receipt page contains the full itemized breakdown organized by category:
If you can't find the receipt link, fall back to the order detail page — item names are in img alt text (no prices/quantities, but names are enough for search).
Build a JSON array from the receipt. Each item:
[
{"name": "Cilantro Bunch", "qty": 1, "price": 1.49},
{"name": "Simply Pulp Free Orange Juice Bottles", "qty": 1, "price": 7.99},
{"name": "LaCroix Sparkling Water, Orange", "qty": 2, "price": 8.58}
]
Rules:
name: product name without size/variant in parentheses — keep it searchableqty: number of units ordered (the "2 x" part)price: final item price after loyalty savings (not original price)python3 ~/.config/spratt/infrastructure/orders/order-ingest.py update-items \
--source instacart \
--order-id "ORDER_ID" \
--items 'JSON_ARRAY' \
--total TOTAL \
--store STORE_NAME
Always include --store (e.g. qfc, costco, safeway). The store name is visible on the order list and detail pages. This powers the purchase cadence analysis for smart reordering.
If the order doesn't exist yet (backfill), use insert mode:
python3 ~/.config/spratt/infrastructure/orders/order-ingest.py \
--source instacart \
--order-id "ORDER_ID" \
--date "YYYY-MM-DD" \
--items 'JSON_ARRAY' \
--total TOTAL \
--store STORE_NAME
After updating, verify:
sqlite3 ~/.config/spratt/orders/orders.sqlite \
"SELECT id, order_date, json_array_length(items) as item_count, total FROM orders WHERE source = 'instacart' ORDER BY order_date DESC LIMIT 5;"
profile: "user" with the browser — always use the default openclaw profile