Skip to content

Voice Intent: order_groceries #60

@akisma

Description

@akisma

Description

Add voice commands for initiating grocery delivery orders. Users should be able to say "Order these groceries" or "Send my shopping list to Instacart" while viewing a list, triggering the cart creation and checkout flow. This completes the voice-first grocery ordering experience.

Acceptance Criteria (Gherkin)

Scenario: Order current list via voice
  Given I have an active shopping list
  And I am connected to Instacart
  When I say "Order these groceries"
  Then the cart creation process begins
  And I hear "Creating your Instacart cart with 15 items"

Scenario: Specify delivery service
  Given I have multiple grocery services connected
  When I say "Order from Instacart"
  Then items are sent to Instacart specifically

Scenario: Not connected prompt
  Given I am not connected to any grocery service
  When I say "Order my groceries"
  Then I hear "You'll need to connect a grocery delivery service first. Would you like to set that up?"

Scenario: Confirm before ordering
  Given I have a large shopping list
  When I say "Order my groceries"
  Then I hear "Ready to order 23 items from Whole Foods. Say 'confirm' to proceed."

Scenario: Check order status
  Given I placed an Instacart order
  When I say "What's the status of my grocery order?"
  Then I hear current order status ("Your order is being shopped" etc.)

Technical Notes

Intent Actions:

  • order_groceries: Initiate cart creation and checkout
  • check_grocery_order: Get order status

Entity Extraction:

  • provider: "instacart", "amazon fresh", etc.
  • list_reference: "this list", specific list name
  • store: preferred store if multiple available

Voice Handler:

private async handleOrderGroceries(entities, session) {
  const list = await this.resolveShoppingList(entities, session);
  const connection = await this.groceryService.getConnection(session.userId);
  
  if (!connection) {
    return this.promptForGroceryConnection();
  }
  
  // Create cart
  const cartResult = await this.instacartService.createCartFromList(
    session.userId,
    { shoppingListId: list.id }
  );
  
  // Provide verbal summary
  const summary = `Creating your ${connection.provider} cart with ${cartResult.itemCount} items from ${cartResult.storeName}`;
  
  // Push checkout link to phone
  await this.pushCheckoutLink(session.userId, cartResult.checkoutUrl);
  
  return summary;
}

GPT-4 System Prompt Addition:

  • order_groceries: "Order my groceries" -> Send shopping list to delivery service
  • check_grocery_order: "What's the status of my order?"

Follow-up Flow:
After "confirm", verbally guide user:
"Great! I'm sending 23 items to Instacart. Open the notification on your phone to complete checkout."

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions