Shopify Integration ↗
noOriginal Documentation
Documentation Index#
Fetch the complete documentation index at: https://docs.crewai.com/llms.txt Use this file to discover all available pages before exploring further.
E-commerce and online store management with Shopify integration for CrewAI.
Overview#
Enable your agents to manage e-commerce operations through Shopify. Handle customers, orders, products, inventory, and store analytics to streamline your online business with AI-powered automation.
Prerequisites#
Before using the Shopify integration, ensure you have:
- A CrewAI AMP account with an active subscription
- A Shopify store with appropriate admin permissions
- Connected your Shopify store through the Integrations page
Setting Up Shopify Integration#
1. Connect Your Shopify Store#
- Navigate to CrewAI AMP Integrations
- Find Shopify in the Authentication Integrations section
- Click Connect and complete the OAuth flow
- Grant the necessary permissions for store and product management
- Copy your Enterprise Token from Integration Settings
2. Install Required Package#
uv add crewai-tools3. Environment Variable Setup#
To use integrations with Agent(apps=[]), you must set the
CREWAI_PLATFORM_INTEGRATION_TOKEN environment variable with your Enterprise
Token.
export CREWAI_PLATFORM_INTEGRATION_TOKEN="your_enterprise_token"Or add it to your .env file:
CREWAI_PLATFORM_INTEGRATION_TOKEN=your_enterprise_tokenAvailable Tools#
Customer Management#
Parameters:
customerIds(string, optional): Comma-separated list of customer IDs to filter by (example: “207119551, 207119552”)createdAtMin(string, optional): Only return customers created after this date (ISO or Unix timestamp)createdAtMax(string, optional): Only return customers created before this date (ISO or Unix timestamp)updatedAtMin(string, optional): Only return customers updated after this date (ISO or Unix timestamp)updatedAtMax(string, optional): Only return customers updated before this date (ISO or Unix timestamp)limit(string, optional): Maximum number of customers to return (defaults to 250)
Description: Search for customers using advanced filtering criteria.
Parameters:
filterFormula(object, optional): Advanced filter in disjunctive normal form with field-specific operatorslimit(string, optional): Maximum number of customers to return (defaults to 250)
Description: Create a new customer in your Shopify store.
Parameters:
firstName(string, required): Customer’s first namelastName(string, required): Customer’s last nameemail(string, required): Customer’s email addresscompany(string, optional): Company namestreetAddressLine1(string, optional): Street addressstreetAddressLine2(string, optional): Street address line 2city(string, optional): Citystate(string, optional): State or province codecountry(string, optional): CountryzipCode(string, optional): Zip codephone(string, optional): Phone numbertags(string, optional): Tags as array or comma-separated listnote(string, optional): Customer notesendEmailInvite(boolean, optional): Whether to send email invitationmetafields(object, optional): Additional metafields in JSON format
Description: Update an existing customer in your Shopify store.
Parameters:
customerId(string, required): The ID of the customer to updatefirstName(string, optional): Customer’s first namelastName(string, optional): Customer’s last nameemail(string, optional): Customer’s email addresscompany(string, optional): Company namestreetAddressLine1(string, optional): Street addressstreetAddressLine2(string, optional): Street address line 2city(string, optional): Citystate(string, optional): State or province codecountry(string, optional): CountryzipCode(string, optional): Zip codephone(string, optional): Phone numbertags(string, optional): Tags as array or comma-separated listnote(string, optional): Customer notesendEmailInvite(boolean, optional): Whether to send email invitationmetafields(object, optional): Additional metafields in JSON format
Order Management#
Parameters:
orderIds(string, optional): Comma-separated list of order IDs to filter by (example: “450789469, 450789470”)createdAtMin(string, optional): Only return orders created after this date (ISO or Unix timestamp)createdAtMax(string, optional): Only return orders created before this date (ISO or Unix timestamp)updatedAtMin(string, optional): Only return orders updated after this date (ISO or Unix timestamp)updatedAtMax(string, optional): Only return orders updated before this date (ISO or Unix timestamp)limit(string, optional): Maximum number of orders to return (defaults to 250)
Description: Create a new order in your Shopify store.
Parameters:
email(string, required): Customer email addresslineItems(object, required): Order line items in JSON format with title, price, quantity, and variant_idsendReceipt(boolean, optional): Whether to send order receiptfulfillmentStatus(string, optional): Fulfillment status - Options: fulfilled, null, partial, restockedfinancialStatus(string, optional): Financial status - Options: pending, authorized, partially_paid, paid, partially_refunded, refunded, voidedinventoryBehaviour(string, optional): Inventory behavior - Options: bypass, decrement_ignoring_policy, decrement_obeying_policynote(string, optional): Order note
Description: Update an existing order in your Shopify store.
Parameters:
orderId(string, required): The ID of the order to updateemail(string, optional): Customer email addresslineItems(object, optional): Updated order line items in JSON formatsendReceipt(boolean, optional): Whether to send order receiptfulfillmentStatus(string, optional): Fulfillment status - Options: fulfilled, null, partial, restockedfinancialStatus(string, optional): Financial status - Options: pending, authorized, partially_paid, paid, partially_refunded, refunded, voidedinventoryBehaviour(string, optional): Inventory behavior - Options: bypass, decrement_ignoring_policy, decrement_obeying_policynote(string, optional): Order note
Description: Retrieve abandoned carts from your Shopify store.
Parameters:
createdWithInLast(string, optional): Restrict results to checkouts created within specified timecreatedAfterId(string, optional): Restrict results to after the specified IDstatus(string, optional): Show checkouts with given status - Options: open, closed (defaults to open)createdAtMin(string, optional): Only return carts created after this date (ISO or Unix timestamp)createdAtMax(string, optional): Only return carts created before this date (ISO or Unix timestamp)limit(string, optional): Maximum number of carts to return (defaults to 250)
Product Management (REST API)#
Parameters:
productIds(string, optional): Comma-separated list of product IDs to filter by (example: “632910392, 632910393”)title(string, optional): Filter by product titleproductType(string, optional): Filter by product typevendor(string, optional): Filter by vendorstatus(string, optional): Filter by status - Options: active, archived, draftcreatedAtMin(string, optional): Only return products created after this date (ISO or Unix timestamp)createdAtMax(string, optional): Only return products created before this date (ISO or Unix timestamp)updatedAtMin(string, optional): Only return products updated after this date (ISO or Unix timestamp)updatedAtMax(string, optional): Only return products updated before this date (ISO or Unix timestamp)limit(string, optional): Maximum number of products to return (defaults to 250)
Description: Create a new product in your Shopify store using REST API.
Parameters:
title(string, required): Product titleproductType(string, required): Product type/categoryvendor(string, required): Product vendorproductDescription(string, optional): Product description (accepts plain text or HTML)tags(string, optional): Product tags as array or comma-separated listprice(string, optional): Product priceinventoryPolicy(string, optional): Inventory policy - Options: deny, continueimageUrl(string, optional): Product image URLisPublished(boolean, optional): Whether product is publishedpublishToPointToSale(boolean, optional): Whether to publish to point of sale
Description: Update an existing product in your Shopify store using REST API.
Parameters:
productId(string, required): The ID of the product to updatetitle(string, optional): Product titleproductType(string, optional): Product type/categoryvendor(string, optional): Product vendorproductDescription(string, optional): Product description (accepts plain text or HTML)tags(string, optional): Product tags as array or comma-separated listprice(string, optional): Product priceinventoryPolicy(string, optional): Inventory policy - Options: deny, continueimageUrl(string, optional): Product image URLisPublished(boolean, optional): Whether product is publishedpublishToPointToSale(boolean, optional): Whether to publish to point of sale
Product Management (GraphQL)#
Parameters:
productFilterFormula(object, optional): Advanced filter in disjunctive normal form with support for fields like id, title, vendor, status, handle, tag, created_at, updated_at, published_at
Description: Create a new product using GraphQL API with enhanced media support.
Parameters:
title(string, required): Product titleproductType(string, required): Product type/categoryvendor(string, required): Product vendorproductDescription(string, optional): Product description (accepts plain text or HTML)tags(string, optional): Product tags as array or comma-separated listmedia(object, optional): Media objects with alt text, content type, and source URLadditionalFields(object, optional): Additional product fields like status, requiresSellingPlan, giftCard
Description: Update an existing product using GraphQL API with enhanced media support.
Parameters:
productId(string, required): The GraphQL ID of the product to update (e.g., “gid://shopify/Product/913144112”)title(string, optional): Product titleproductType(string, optional): Product type/categoryvendor(string, optional): Product vendorproductDescription(string, optional): Product description (accepts plain text or HTML)tags(string, optional): Product tags as array or comma-separated listmedia(object, optional): Updated media objects with alt text, content type, and source URLadditionalFields(object, optional): Additional product fields like status, requiresSellingPlan, giftCard
Usage Examples#
Basic Shopify Agent Setup#
from crewai import Agent, Task, Crew
from crewai import Agent, Task, Crew
# Create an agent with Shopify capabilities
shopify_agent = Agent(
role="E-commerce Manager",
goal="Manage online store operations and customer relationships efficiently",
backstory="An AI assistant specialized in e-commerce operations and online store management.",
apps=['shopify'] # All Shopify actions will be available
)
# Task to create a new customer
create_customer_task = Task(
description="Create a new VIP customer Jane Smith with email jane.smith@example.com and phone +1-555-0123",
agent=shopify_agent,
expected_output="Customer created successfully with customer ID"
)
# Run the task
crew = Crew(
agents=[shopify_agent],
tasks=[create_customer_task]
)
crew.kickoff()Filtering Specific Shopify Tools#
store_manager = Agent(
role="Store Manager",
goal="Manage customer orders and product catalog",
backstory="An experienced store manager who handles customer relationships and inventory management.",
apps=['shopify/create_customer']
)
# Task to manage store operations
store_task = Task(
description="Create a new customer and process their order for 2 Premium Coffee Mugs",
agent=store_manager,
expected_output="Customer created and order processed successfully"
)
crew = Crew(
agents=[store_manager],
tasks=[store_task]
)
crew.kickoff()Product Management with GraphQL#
from crewai import Agent, Task, Crew
product_manager = Agent(
role="Product Manager",
goal="Manage product catalog and inventory with advanced GraphQL capabilities",
backstory="An AI assistant that specializes in product management and catalog optimization.",
apps=['shopify']
)
# Task to manage product catalog
catalog_task = Task(
description="""
1. Create a new product "Premium Coffee Mug" from Coffee Co vendor
2. Add high-quality product images and descriptions
3. Search for similar products from the same vendor
4. Update product tags and pricing strategy
""",
agent=product_manager,
expected_output="Product created and catalog optimized successfully"
)
crew = Crew(
agents=[product_manager],
tasks=[catalog_task]
)
crew.kickoff()Order and Customer Analytics#
from crewai import Agent, Task, Crew
analytics_agent = Agent(
role="E-commerce Analyst",
goal="Analyze customer behavior and order patterns to optimize store performance",
backstory="An analytical AI that excels at extracting insights from e-commerce data.",
apps=['shopify']
)
# Complex task involving multiple operations
analytics_task = Task(
description="""
1. Retrieve recent customer data and order history
2. Identify abandoned carts from the last 7 days
3. Analyze product performance and inventory levels
4. Generate recommendations for customer retention
""",
agent=analytics_agent,
expected_output="Comprehensive e-commerce analytics report with actionable insights"
)
crew = Crew(
agents=[analytics_agent],
tasks=[analytics_task]
)
crew.kickoff()Getting Help#
Contact our support team for assistance with Shopify integration setup or troubleshooting.