Shopify 集成
让你的智能体通过 Shopify 管理电商运营。你可以处理客户、订单、产品、库存和店铺分析,从而借助 AI 驱动的自动化简化在线业务。
在使用 Shopify 集成之前,请确保你已具备:
- 一个拥有有效订阅的 CrewAI AMP 账户
- 一个具备相应管理员权限的 Shopify 商店
- 通过 集成页面 连接了你的 Shopify 商店
设置 Shopify 集成
Section titled “设置 Shopify 集成”1. 连接你的 Shopify 商店
Section titled “1. 连接你的 Shopify 商店”- 访问 CrewAI AMP Integrations
- 在 Authentication Integrations 部分找到 Shopify
- 点击 Connect 并完成 OAuth 流程
- 授予店铺和产品管理所需权限
- 从 Integration Settings 复制你的 Enterprise Token
2. 安装所需包
Section titled “2. 安装所需包”uv add crewai-tools3. 环境变量设置
Section titled “3. 环境变量设置”export CREWAI_PLATFORM_INTEGRATION_TOKEN="your_enterprise_token"或者将其添加到你的 .env 文件中:
CREWAI_PLATFORM_INTEGRATION_TOKEN=your_enterprise_tokenshopify/get_customers
说明: 检索 Shopify 商店中的客户列表。
参数:
customerIds(string, optional): 用逗号分隔的客户 ID 列表,用于筛选(示例:“207119551, 207119552”)createdAtMin(string, optional): 仅返回此日期之后创建的客户(ISO 或 Unix 时间戳)createdAtMax(string, optional): 仅返回此日期之前创建的客户(ISO 或 Unix 时间戳)updatedAtMin(string, optional): 仅返回此日期之后更新的客户(ISO 或 Unix 时间戳)updatedAtMax(string, optional): 仅返回此日期之前更新的客户(ISO 或 Unix 时间戳)limit(string, optional): 要返回的客户最大数量(默认 250)
shopify/search_customers
说明: 使用高级筛选条件搜索客户。
参数:
filterFormula(object, optional): 以析取范式表示的高级筛选条件,支持字段特定运算符limit(string, optional): 要返回的客户最大数量(默认 250)
shopify/create_customer
说明: 在你的 Shopify 商店中创建新客户。
参数:
firstName(string, required): 客户名字lastName(string, required): 客户姓氏email(string, required): 客户电子邮件地址company(string, optional): 公司名称streetAddressLine1(string, optional): 街道地址streetAddressLine2(string, optional): 街道地址第 2 行city(string, optional): 城市state(string, optional): 州或省代码country(string, optional): 国家/地区zipCode(string, optional): 邮政编码phone(string, optional): 电话号码tags(string, optional): 作为数组或逗号分隔列表的标签note(string, optional): 客户备注sendEmailInvite(boolean, optional): 是否发送电子邮件邀请metafields(object, optional): JSON 格式的附加 metafields
shopify/update_customer
说明: 更新 Shopify 商店中的现有客户。
参数:
customerId(string, required): 要更新的客户 IDfirstName(string, optional): 客户名字lastName(string, optional): 客户姓氏email(string, optional): 客户电子邮件地址company(string, optional): 公司名称streetAddressLine1(string, optional): 街道地址streetAddressLine2(string, optional): 街道地址第 2 行city(string, optional): 城市state(string, optional): 州或省代码country(string, optional): 国家/地区zipCode(string, optional): 邮政编码phone(string, optional): 电话号码tags(string, optional): 作为数组或逗号分隔列表的标签note(string, optional): 客户备注sendEmailInvite(boolean, optional): 是否发送电子邮件邀请metafields(object, optional): JSON 格式的附加 metafields
shopify/get_orders
说明: 检索 Shopify 商店中的订单列表。
参数:
orderIds(string, optional): 用逗号分隔的订单 ID 列表,用于筛选(示例:“450789469, 450789470”)createdAtMin(string, optional): 仅返回此日期之后创建的订单(ISO 或 Unix 时间戳)createdAtMax(string, optional): 仅返回此日期之前创建的订单(ISO 或 Unix 时间戳)updatedAtMin(string, optional): 仅返回此日期之后更新的订单(ISO 或 Unix 时间戳)updatedAtMax(string, optional): 仅返回此日期之前更新的订单(ISO 或 Unix 时间戳)limit(string, optional): 要返回的订单最大数量(默认 250)
shopify/create_order
说明: 在你的 Shopify 商店中创建新订单。
参数:
email(string, required): 客户电子邮件地址lineItems(object, required): JSON 格式的订单行项目,包含标题、价格、数量和 variant_idsendReceipt(boolean, optional): 是否发送订单收据fulfillmentStatus(string, optional): 履约状态 - 选项:fulfilled, null, partial, restockedfinancialStatus(string, optional): 财务状态 - 选项:pending, authorized, partially_paid, paid, partially_refunded, refunded, voidedinventoryBehaviour(string, optional): 库存行为 - 选项:bypass, decrement_ignoring_policy, decrement_obeying_policynote(string, optional): 订单备注
shopify/update_order
说明: 更新 Shopify 商店中的现有订单。
参数:
orderId(string, required): 要更新的订单 IDemail(string, optional): 客户电子邮件地址lineItems(object, optional): JSON 格式的更新后订单行项目sendReceipt(boolean, optional): 是否发送订单收据fulfillmentStatus(string, optional): 履约状态 - 选项:fulfilled, null, partial, restockedfinancialStatus(string, optional): 财务状态 - 选项:pending, authorized, partially_paid, paid, partially_refunded, refunded, voidedinventoryBehaviour(string, optional): 库存行为 - 选项:bypass, decrement_ignoring_policy, decrement_obeying_policynote(string, optional): 订单备注
shopify/get_abandoned_carts
说明: 检索 Shopify 商店中的弃购购物车。
参数:
createdWithInLast(string, optional): 仅返回在指定时间内创建的结账createdAfterId(string, optional): 限制结果为指定 ID 之后的结账status(string, optional): 显示具有指定状态的结账 - 选项:open, closed(默认值为 open)createdAtMin(string, optional): 仅返回此日期之后创建的购物车(ISO 或 Unix 时间戳)createdAtMax(string, optional): 仅返回此日期之前创建的购物车(ISO 或 Unix 时间戳)limit(string, optional): 要返回的购物车最大数量(默认 250)
产品管理(REST API)
Section titled “产品管理(REST API)”shopify/get_products
说明: 通过 REST API 检索 Shopify 商店中的产品列表。
参数:
productIds(string, optional): 用逗号分隔的产品 ID 列表,用于筛选(示例:“632910392, 632910393”)title(string, optional): 按产品标题筛选productType(string, optional): 按产品类型筛选vendor(string, optional): 按供应商筛选status(string, optional): 按状态筛选 - 选项:active, archived, draftcreatedAtMin(string, optional): 仅返回此日期之后创建的产品(ISO 或 Unix 时间戳)createdAtMax(string, optional): 仅返回此日期之前创建的产品(ISO 或 Unix 时间戳)updatedAtMin(string, optional): 仅返回此日期之后更新的产品(ISO 或 Unix 时间戳)updatedAtMax(string, optional): 仅返回此日期之前更新的产品(ISO 或 Unix 时间戳)limit(string, optional): 要返回的产品最大数量(默认 250)
shopify/create_product
说明: 通过 REST API 在你的 Shopify 商店中创建新产品。
参数:
title(string, required): 产品标题productType(string, required): 产品类型/分类vendor(string, required): 产品供应商productDescription(string, optional): 产品描述(支持纯文本或 HTML)tags(string, optional): 作为数组或逗号分隔列表的产品标签price(string, optional): 产品价格inventoryPolicy(string, optional): 库存策略 - 选项:deny, continueimageUrl(string, optional): 产品图片 URLisPublished(boolean, optional): 产品是否已发布publishToPointToSale(boolean, optional): 是否发布到销售点
shopify/update_product
说明: 通过 REST API 更新你 Shopify 商店中的现有产品。
参数:
productId(string, required): 要更新的产品 IDtitle(string, optional): 产品标题productType(string, optional): 产品类型/分类vendor(string, optional): 产品供应商productDescription(string, optional): 产品描述(支持纯文本或 HTML)tags(string, optional): 作为数组或逗号分隔列表的产品标签price(string, optional): 产品价格inventoryPolicy(string, optional): 库存策略 - 选项:deny, continueimageUrl(string, optional): 产品图片 URLisPublished(boolean, optional): 产品是否已发布publishToPointToSale(boolean, optional): 是否发布到销售点
产品管理(GraphQL)
Section titled “产品管理(GraphQL)”shopify/get_products_graphql
说明: 使用高级 GraphQL 筛选能力检索产品。
参数:
productFilterFormula(object, optional): 以析取范式表示的高级筛选,支持 id、title、vendor、status、handle、tag、created_at、updated_at、published_at 等字段
shopify/create_product_graphql
说明: 通过 GraphQL API 创建新产品,并增强媒体支持。
参数:
title(string, required): 产品标题productType(string, required): 产品类型/分类vendor(string, required): 产品供应商productDescription(string, optional): 产品描述(支持纯文本或 HTML)tags(string, optional): 作为数组或逗号分隔列表的产品标签media(object, optional): 带有替代文本、内容类型和源 URL 的媒体对象additionalFields(object, optional): 额外产品字段,如 status、requiresSellingPlan、giftCard
shopify/update_product_graphql
说明: 通过 GraphQL API 更新现有产品,并增强媒体支持。
参数:
productId(string, required): 要更新的产品 GraphQL ID(例如:“gid://shopify/Product/913144112”)title(string, optional): 产品标题productType(string, optional): 产品类型/分类vendor(string, optional): 产品供应商productDescription(string, optional): 产品描述(支持纯文本或 HTML)tags(string, optional): 作为数组或逗号分隔列表的产品标签media(object, optional): 更新后的媒体对象,包含替代文本、内容类型和源 URLadditionalFields(object, optional): 额外产品字段,如 status、requiresSellingPlan、giftCard
基础 Shopify 智能体设置
Section titled “基础 Shopify 智能体设置”from crewai import Agent, Task, Crewfrom crewai import Agent, Task, Crew
# Create an agent with Shopify capabilitiesshopify_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 customercreate_customer_task = Task( description="Create a new VIP customer Jane Smith with email [email protected] and phone +1-555-0123", agent=shopify_agent, expected_output="Customer created successfully with customer ID")
# Run the taskcrew = Crew( agents=[shopify_agent], tasks=[create_customer_task])
crew.kickoff()筛选特定 Shopify 工具
Section titled “筛选特定 Shopify 工具”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 operationsstore_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()通过 GraphQL 进行产品管理
Section titled “通过 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 catalogcatalog_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()订单与客户分析
Section titled “订单与客户分析”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 operationsanalytics_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()需要帮助?
联系我们的支持团队,获取 Shopify 集成设置或故障排查方面的帮助。