Back to Architecture
instantAIguruDocumentation

Shopify Flows

Shopify Flows Library

This document details the e-commerce flows provided in the flows/shopify.flows.json library. These flows provide integration with Shopify for product search, order tracking, and store policy inquiries.

Table of Contents


ShopifyProductSearch

ID: shopify-product-search
Triggers: "product search", "buscar producto"
Description: Help customers search for products, check stock availability, and find local store availability.

This flow powers natural language product discovery. It captures a user's search intent, queries the Shopify catalog via shopify-search-products, and formats the results with pricing and stock status. Uniquely, it extends the digital experience to physical retail by allowing users to check inventory at nearby store locations (shopify-store-availability) for a selected product variant.

Parameters

  • search_query (string): The product name, brand, or features to search for.

Flowchart

Missing

Present

On Fail

Found

None

Stores Configured

No Stores

Done/No

Select 1-5

No Input

Default

Yes

No

On Fail

In Stock

Out of Stock

Error

Start

Check Param

FLOW: GetSearchQuery

SET

TOOL: shopify-search-products
Var: search_result
Args: query, limit

Results Found?

FLOW: NoActionNeeded

SAY
Value: 'Great! Here\'s what I found...'

FLOW: NoActionNeeded

Check Local Stores

SAY-GET
Var: product_choice
Prompt: 'Would you like to check which stores...'

SAY-GET
Var: user_prompt
Prompt: 'Is there anything else...'

User Choice

RETURN
Value: 'Cool! If you need anything else...'

SET
Var: product_idx
Value: index - 1

RETURN
Value: ''

FLOW: NoActionNeeded

SET
Var: selected_product
Value: search_result.idx

SAY-GET
Var: user_city
Prompt: 'What city are you near?'

SET
Var: user_city

SET
Var: selected_variant

Variant OK?

TOOL: shopify-store-availability
Var: store_availability
Args: variantId, city

RETURN
Value: 'Sorry, I couldn\'t get variant info...'

Check Stock

RETURN
Value: 'Sorry, I couldn\'t check...'

RETURN
Value: Store List

RETURN
Value: 'Sorry, this product isn\'t available...'

RETURN
Value: 'I couldn\'t check...'

End


GetSearchQuery

ID: get-search-query
Description: Helper flow to request a search string from the user.

A helper flow that ensures a valid search term is captured. If the user hasn't provided a query yet, it prompts them explicitly ("What are you looking for?"). It handles the input normalization and checks for exit commands before returning the query to the parent flow.

Flowchart

Exit/Abort

Live Agent

Default

Start

SAY-GET
Var: search_query
Prompt: 'Please describe the product...'

SET
Var: search_query

Check Input

FLOW: CancelProcess

FLOW: LiveAgentRequested

SET
Var: proceed
Value: true

End


ShopifyTrackOrder

ID: shopify-track-order
Triggers: "track order", "rastrear pedido"
Description: Help customers view orders and track status. Enforces authentication via AuthenticateUser.

This flow handles post-purchase inquiries. Recognizing that order data is sensitive, it enforces a security check by invoking AuthenticateUser before proceeding. Once identity is established, it forwards control to ShopifyGetOrdersVerified to display the data.

Parameters

  • order_number (string): Specific order number to track.

Flowchart

Verified

Not Verified

Start

SET

SET

SAY
Value: 'To track your order, I need to verify...'

Verified?

FLOW: ShopifyGetOrdersVerified

FLOW: AuthenticateUser

FLOW: ShopifyGetOrdersVerified

End


ShopifyGetOrdersVerified

ID: shopify-get-orders-verified
Description: Secure flow to list orders or get details for a verified user.

The core logic for order retrieval. It uses the shopify-lookup-orders tool to fetch recent order history for the verified user. It presents a summary list and allows the user to drill down into specific order details (using shopify-get-order-status) to see line items, fulfillment status, and tracking links.

Flowchart

No Order Num

Has Order Num

On Fail

Error

0 Orders

1 Order

Multiple

Yes

No

Option 1-5

Default

Yes

No

On Fail

Success

Not Found

Start

SET
Var: shopify_identifier
Value: authenticated email/phone

Specific Order?

TOOL: shopify-lookup-orders
Var: orders_result
Args: identifier, container

SET
Var: orders_result
Value: Fake Result

FLOW: GenericRetryWithOptions

Process Orders

FLOW: ContactSupport

RETURN
Value: 'Sorry, I couldn\'t find any orders...'

SET
Var: order_number
Value: orders_result.orders.0

SAY-GET
Var: user_choice
Prompt: 'Hi... Here are your recent orders...'

Has Selection?

SET
Var: go_to_details
Value: true

SET
Var: go_to_details
Value: false

User Input

SET
Var: order_number
Value: Select Order Num

RETURN
Value: 'Cool! Anything else...?'

Has Order Num?

TOOL: shopify-get-order-status
Var: order_detail
Args: orderNumber, identifier

FLOW: ContactSupport

SAY
Value: 'I couldn\'t retrieve details...'

Show Details

SAY
Value: 'Order details...'

SAY
Value: 'Sorry, I couldn\'t find that order...'

End


ShopifyStorePolicies

ID: shopify-store-policies
Triggers: "store policies", "políticas de la tienda"
Description: Help customers find online store policies and FAQs.

This flow provides access to static store content. It captures a policy topic (e.g., "Returns", "Shipping") and uses the shopify-search-policies tool to retrieve relevant text from the store's knowledge base, returning the answer directly to the conversation.

Parameters

  • policy_query (string): The user's question about store policies.

Flowchart

Missing

Present

On Fail

Content

No Content

Start

Check Param

SAY-GET
Var: policy_query
Prompt: 'What would you like to know about?'

SET
Var: proceed
Value: true

TOOL: shopify-search-policies
Var: policy_result
Args: query, context

FLOW: NoActionNeeded

Found?

SAY
Value: 'Here is what I found...'

FLOW: NoActionNeeded

End