跳转到内容

Shopify 集成

让你的智能体通过 Shopify 管理电商运营。你可以处理客户、订单、产品、库存和店铺分析,从而借助 AI 驱动的自动化简化在线业务。

在使用 Shopify 集成之前,请确保你已具备:

  • 一个拥有有效订阅的 CrewAI AMP 账户
  • 一个具备相应管理员权限的 Shopify 商店
  • 通过 集成页面 连接了你的 Shopify 商店
  1. 访问 CrewAI AMP Integrations
  2. 在 Authentication Integrations 部分找到 Shopify
  3. 点击 Connect 并完成 OAuth 流程
  4. 授予店铺和产品管理所需权限
  5. Integration Settings 复制你的 Enterprise Token
Terminal window
uv add crewai-tools
Terminal window
export CREWAI_PLATFORM_INTEGRATION_TOKEN="your_enterprise_token"

或者将其添加到你的 .env 文件中:

CREWAI_PLATFORM_INTEGRATION_TOKEN=your_enterprise_token
shopify/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): 要更新的客户 ID
  • firstName (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_id
  • sendReceipt (boolean, optional): 是否发送订单收据
  • fulfillmentStatus (string, optional): 履约状态 - 选项:fulfilled, null, partial, restocked
  • financialStatus (string, optional): 财务状态 - 选项:pending, authorized, partially_paid, paid, partially_refunded, refunded, voided
  • inventoryBehaviour (string, optional): 库存行为 - 选项:bypass, decrement_ignoring_policy, decrement_obeying_policy
  • note (string, optional): 订单备注
shopify/update_order

说明: 更新 Shopify 商店中的现有订单。

参数:

  • orderId (string, required): 要更新的订单 ID
  • email (string, optional): 客户电子邮件地址
  • lineItems (object, optional): JSON 格式的更新后订单行项目
  • sendReceipt (boolean, optional): 是否发送订单收据
  • fulfillmentStatus (string, optional): 履约状态 - 选项:fulfilled, null, partial, restocked
  • financialStatus (string, optional): 财务状态 - 选项:pending, authorized, partially_paid, paid, partially_refunded, refunded, voided
  • inventoryBehaviour (string, optional): 库存行为 - 选项:bypass, decrement_ignoring_policy, decrement_obeying_policy
  • note (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)
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, draft
  • 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_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, continue
  • imageUrl (string, optional): 产品图片 URL
  • isPublished (boolean, optional): 产品是否已发布
  • publishToPointToSale (boolean, optional): 是否发布到销售点
shopify/update_product

说明: 通过 REST API 更新你 Shopify 商店中的现有产品。

参数:

  • productId (string, required): 要更新的产品 ID
  • title (string, optional): 产品标题
  • productType (string, optional): 产品类型/分类
  • vendor (string, optional): 产品供应商
  • productDescription (string, optional): 产品描述(支持纯文本或 HTML)
  • tags (string, optional): 作为数组或逗号分隔列表的产品标签
  • price (string, optional): 产品价格
  • inventoryPolicy (string, optional): 库存策略 - 选项:deny, continue
  • imageUrl (string, optional): 产品图片 URL
  • isPublished (boolean, optional): 产品是否已发布
  • publishToPointToSale (boolean, optional): 是否发布到销售点
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): 更新后的媒体对象,包含替代文本、内容类型和源 URL
  • additionalFields (object, optional): 额外产品字段,如 status、requiresSellingPlan、giftCard
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 [email protected] 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()
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()
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()
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()

需要帮助?

联系我们的支持团队,获取 Shopify 集成设置或故障排查方面的帮助。