Created At: 25 April, 2026
Last Edited At: 21 May, 2026
Submitted At: 27 April, 2026
In a shared household, everyone has needs but no one has full visibility. Person 1 orders milk not knowing Person 2 already ordered it. Person 3 forgets to tell anyone they used the last of the detergent. Items get duplicated, items get missed, and the coordination happens after the fact.
The problem is not Instamart. The problem is there is no shared layer, no single view of what the household needs. Each person is ordering in isolation.
Picture a WhatsApp group: three flatmates, one shared address. There is a fourth member in the group, HumaraCart, an AI agent.
Throughout the day, as people notice things running low, they just say it:
add milkadd detergentadd chipsremove detergentshow listHumaraCart maintains a running cart for the household. No one has to remember. No one has to open Instamart. When the list feels ready, any member nudges the account holder. The account holder gets notified, opens Instamart, and places the order themselves. That is it.
This is the vision.
WhatsApp Business API does not natively support group bots. A bot cannot be added as a member of a WhatsApp group.
Each household member has a 1:1 conversation with the bot. On the backend, all members are mapped to a shared household group ID. Every addition is reflected in one unified list. Members who opt in receive the updated list after every addition.
The user experience is identical to the group vision. The difference is only under the hood. This approach works fully within the official WhatsApp Business API. No unofficial libraries. No ToS risk.
WhatsApp is where Indian households already communicate. Any channel that requires a new app or a new habit creates drop-off before the product gets a chance. WhatsApp is not a technical convenience. It is where the user already is.
flowchart LR
subgraph Household
AH[Account Holder]
M1[Member 1]
M2[Member 2]
AH -->|invite link| M1 & M2
end
subgraph Swiggy
Auth[OAuth Server]
MCP[Instamart MCP Server]
Cart[Instamart Cart]
end
AH -->|"① adds HumaraCart bot on WhatsApp"| Bot[HumaraCart Bot]
M1 & M2 <-->|WhatsApp| Bot
Bot <--> BE[Backend + AI Agent\nMCP Client]
Bot -.->|"② sends Swiggy OAuth link"| AH
AH -.->|"③ authorize"| Auth
Auth <-.->|"④ code exchange → access token"| BE
BE -.->|"⑤ authorization confirmed"| Bot
Bot -.->|"⑥ setup complete"| AH
BE <-->|MCP calls| MCP
MCP <--> Cart
Setup (done once by the account holder):
change command; the new preference is saved automatically.Day-to-day usage:
add milk, add detergent 2, add chips, remove milk, change milk to Mother Dairy, show list.change milk to Mother Dairy or change milk qty to 2. Brand overrides update the household’s saved preference for next time; quantity overrides apply to the current cart only.Ordering:
ready to order. The bot forwards it: “Priya thinks the cart is ready. Want to review?” The account holder can also initiate checkout independently at any time.freeze cart. The cart is locked. No further additions or removals are accepted. All members are notified: “Cart has been frozen by Priya. No more items can be added.”update_cart once to create the cart on Instamart using the item list built over WhatsApp. The bot then sends the account holder a full item summary along with: “Cart created on Instamart. It will expire in X minutes. Open Instamart to place your order.” (The Instamart MCP does not expose a shareable cart link.)Household management:
Note: Member removal is acknowledged as a necessary feature but is beyond the scope of this demo. It will be addressed in V2.
| Layer | Choice |
|---|---|
| Backend | Python, FastAPI |
| Intent Classification | LangChain (with_structured_output + Pydantic) |
| Agent Orchestration | LangGraph |
| LLM | Claude Sonnet 4.6 (via ChatAnthropic) |
| MCP Client | Swiggy Instamart MCP (sandbox for V1; production for V2) |
| Swiggy APIs | TBD. Depends on what is available and exposed (e.g. order tracking) |
| Messaging | Twilio Sandbox for WhatsApp (V1); WhatsApp Business API (V2) |
| Cache | Redis |
| Database | PostgreSQL |
| Observability | LangSmith |
| Infrastructure | Docker |
| Hosting | Local for V1 (laptop + ngrok or cloudflared tunnelling the Twilio webhook); DigitalOcean for V2+ |
The backend acts as the MCP client, receiving WhatsApp messages, resolving household context, and making Instamart MCP tool calls to search products and manage the shared cart. LangChain classifies inbound messages into a typed Intent via structured-output parsing, so natural-language variants (“milk please”, “drop the detergent”) are recognised robustly. LangGraph orchestrates the stateful agent flows: routing intents to handler subgraphs, mutating cart state across nodes, and persisting via the write-through store.
Active cart state is managed using a write-through cache: every add/remove writes to both Redis and PostgreSQL simultaneously. Redis serves fast reads throughout the day; PostgreSQL is the durable backing store. At freeze, the cart is created on Instamart in a single update_cart call. Household data, member mappings, and brand preferences are persisted in PostgreSQL.
Our backend acts as the MCP Client. Cart creation and order management are driven by Instamart MCP tool calls.
Note: For a detailed step-by-step MCP tool call flow, see the sequence diagram here.
| Tool | Triggered When | What It Enables |
|---|---|---|
search_products | Member adds an item | Finds the right product on Instamart |
update_cart | Account holder freezes the cart | Creates the cart on Instamart using the item list built over WhatsApp. Incremental add/remove is unavailable per MCP docs. Cart state is owned by the backend throughout the day and synced to Instamart once at freeze |
get_cart | After update_cart succeeds at freeze | Fetches the confirmed cart state from Instamart to send as a summary to the account holder |
checkout | V3: agent places order on household’s behalf | Used when auto-restock is enabled or account holder grants agent permission to order on approval |
track_order | After order is placed | Fetches live order status for broadcast |
get_orders | V2: purchase patterns | Enables reorder reminders based on history |
Confirmed: The Instamart MCP does not expose a shareable cart link. The account holder opens Instamart directly to check out. Their cart is already populated by the agent.
Invite system Invite links are signed with a short-lived JWT encoding the household ID and an expiry. Tokens are single-use and tamper-proof. Expired or reused tokens are rejected.
Instamart OAuth The account holder links their Instamart account via OAuth. HumaraCart never handles credentials directly. It operates via an access token scoped to cart and order actions only.
Household isolation All household data is scoped to a group ID on the backend. No member can access or influence another household’s cart.
Cart control stays with the account holder The bot only builds the cart. Checkout is always a manual action by the account holder. In V1 and V2, no order is ever placed without explicit confirmation.
V1: Collaborative Cart Agent builds the cart from household inputs. Account holder reviews and checks out via Instamart. Trust is established.
V2: Household Intelligence
V3: Auto-Order (opt-in) Routine items can be set to auto-order for users who have explicitly granted the agent permission. Fully opt-in and item-specific.
Each stage earns the next. Trust is not assumed. It is built incrementally.
Most Instamart use cases optimise for the individual user. HumaraCart treats the household as the unit, which is how grocery shopping actually works in India.
This is not a chatbot for Instamart. It is a new interface layer for how households shop.
Built on Swiggy Instamart MCP | Contact: mridubhatnagar