跳转到内容

Zendesk 集成

让你的智能体通过 Zendesk 管理客户支持运营。你可以创建和更新工单、管理用户、跟踪支持指标,并借助 AI 驱动的自动化简化客户服务工作流。

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

  • 一个拥有有效订阅的 CrewAI AMP 账户
  • 一个具备相应 API 权限的 Zendesk 账户
  • 通过 集成页面 连接了你的 Zendesk 账户
  1. 访问 CrewAI AMP Integrations
  2. 在 Authentication Integrations 部分找到 Zendesk
  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
zendesk/create_ticket

说明: 在 Zendesk 中创建新的支持工单。

参数:

  • ticketSubject (string, required): 工单主题行(例如:“Help, my printer is on fire!”)
  • ticketDescription (string, required): 显示在工单中的第一条评论(例如:“The smoke is very colorful.”)
  • requesterName (string, required): 请求支持的用户姓名(例如:“Jane Customer”)
  • requesterEmail (string, required): 请求支持的用户电子邮件(例如:“[email protected]”)
  • assigneeId (string, optional): 分配给此工单的 Zendesk Agent ID - 使用 Connect Portal Workflow Settings 让用户选择指派人
  • ticketType (string, optional): 工单类型 - 选项:problem, incident, question, task
  • ticketPriority (string, optional): 优先级 - 选项:urgent, high, normal, low
  • ticketStatus (string, optional): 工单状态 - 选项:new, open, pending, hold, solved, closed
  • ticketDueAt (string, optional): task 类型工单的截止日期(ISO 8601 时间戳)
  • ticketTags (string, optional): 要应用的标签数组(例如:["enterprise", "other_tag"]
  • ticketExternalId (string, optional): 用于将工单链接到本地记录的外部 ID
  • ticketCustomFields (object, optional): JSON 格式的自定义字段值
zendesk/update_ticket

说明: 更新 Zendesk 中现有的支持工单。

参数:

  • ticketId (string, required): 要更新的工单 ID(例如:“35436”)
  • ticketSubject (string, optional): 更新后的工单主题
  • requesterName (string, required): 请求此工单的用户姓名
  • requesterEmail (string, required): 请求此工单的用户电子邮件
  • assigneeId (string, optional): 更新后的指派人 ID - 使用 Connect Portal Workflow Settings
  • ticketType (string, optional): 更新后的工单类型 - 选项:problem, incident, question, task
  • ticketPriority (string, optional): 更新后的优先级 - 选项:urgent, high, normal, low
  • ticketStatus (string, optional): 更新后的状态 - 选项:new, open, pending, hold, solved, closed
  • ticketDueAt (string, optional): 更新后的截止日期(ISO 8601 时间戳)
  • ticketTags (string, optional): 更新后的标签数组
  • ticketExternalId (string, optional): 更新后的外部 ID
  • ticketCustomFields (object, optional): 更新后的自定义字段值
zendesk/get_ticket_by_id

说明: 通过 ID 检索指定工单。

参数:

  • ticketId (string, required): 要检索的工单 ID(例如:“35436”)
zendesk/add_comment_to_ticket

说明: 向现有工单添加评论或内部备注。

参数:

  • ticketId (string, required): 要添加评论的工单 ID(例如:“35436”)
  • commentBody (string, required): 评论内容(支持纯文本或 HTML,例如:“Thanks for your help!”)
  • isInternalNote (boolean, optional): 若为内部备注则设为 true,而不是公开回复(默认值为 false)
  • isPublic (boolean, optional): true 表示公开评论,false 表示内部备注
zendesk/search_tickets

说明: 使用各种筛选条件搜索工单。

参数:

  • ticketSubject (string, optional): 按工单主题文本筛选
  • ticketDescription (string, optional): 按工单描述和评论文本筛选
  • ticketStatus (string, optional): 按状态筛选 - 选项:new, open, pending, hold, solved, closed
  • ticketType (string, optional): 按类型筛选 - 选项:problem, incident, question, task, no_type
  • ticketPriority (string, optional): 按优先级筛选 - 选项:urgent, high, normal, low, no_priority
  • requesterId (string, optional): 按请求者用户 ID 筛选
  • assigneeId (string, optional): 按已指派代理 ID 筛选
  • recipientEmail (string, optional): 按原始收件人电子邮件地址筛选
  • ticketTags (string, optional): 按工单标签筛选
  • ticketExternalId (string, optional): 按外部 ID 筛选
  • createdDate (object, optional): 通过操作符(EQUALS, LESS_THAN_EQUALS, GREATER_THAN_EQUALS)和值按创建日期筛选
  • updatedDate (object, optional): 通过操作符和值按更新日期筛选
  • dueDate (object, optional): 通过操作符和值按截止日期筛选
  • sort_by (string, optional): 排序字段 - 选项:created_at, updated_at, priority, status, ticket_type
  • sort_order (string, optional): 排序方向 - 选项:asc, desc
zendesk/create_user

说明: 在 Zendesk 中创建新用户。

参数:

  • name (string, required): 用户全名
  • email (string, optional): 用户电子邮件(例如:“[email protected]”)
  • phone (string, optional): 用户电话号码
  • role (string, optional): 用户角色 - 选项:admin, agent, end-user
  • externalId (string, optional): 来自其他系统的唯一标识符
  • details (string, optional): 附加用户详情
  • notes (string, optional): 关于该用户的内部备注
zendesk/update_user

说明: 更新现有用户信息。

参数:

  • userId (string, required): 要更新的用户 ID
  • name (string, optional): 更新后的用户名
  • email (string, optional): 更新后的电子邮件(更新时会作为次要电子邮件添加)
  • phone (string, optional): 更新后的电话号码
  • role (string, optional): 更新后的角色 - 选项:admin, agent, end-user
  • externalId (string, optional): 更新后的外部 ID
  • details (string, optional): 更新后的用户详情
  • notes (string, optional): 更新后的内部备注
zendesk/get_user_by_id

说明: 通过 ID 检索指定用户。

参数:

  • userId (string, required): 要检索的用户 ID
zendesk/search_users

说明: 使用各种条件搜索用户。

参数:

  • name (string, optional): 按用户名筛选
  • email (string, optional): 按用户电子邮件筛选(例如:“[email protected]”)
  • role (string, optional): 按角色筛选 - 选项:admin, agent, end-user
  • externalId (string, optional): 按外部 ID 筛选
  • sort_by (string, optional): 排序字段 - 选项:created_at, updated_at
  • sort_order (string, optional): 排序方向 - 选项:asc, desc
zendesk/get_ticket_fields

说明: 检索工单可用的所有标准字段和自定义字段。

参数:

  • paginationParameters (object, optional): 分页设置
    • pageCursor (string, optional): 分页游标
zendesk/get_ticket_audits

说明: 获取工单的审计记录(只读历史)。

参数:

  • ticketId (string, optional): 获取特定工单的审计记录(如果为空,则检索所有未归档工单的审计记录,例如:“1234”)
  • paginationParameters (object, optional): 分页设置
    • pageCursor (string, optional): 分页游标

自定义字段可以让你存储组织特定的附加信息:

[
{ "id": 27642, "value": "745" },
{ "id": 27648, "value": "yes" }
]

了解优先级:

  • urgent - 需要立即关注的关键问题
  • high - 应尽快处理的重要问题
  • normal - 大多数工单的标准优先级
  • low - 可在方便时处理的轻微问题

标准工单状态流转:

  • new - 刚创建,尚未指派
  • open - 正在处理
  • pending - 等待客户响应或外部操作
  • hold - 临时暂停
  • solved - 问题已解决,等待客户确认
  • closed - 工单已完成并关闭
from crewai import Agent, Task, Crew
from crewai import Agent, Task, Crew
# Create an agent with Zendesk capabilities
zendesk_agent = Agent(
role="Support Manager",
goal="Manage customer support tickets and provide excellent customer service",
backstory="An AI assistant specialized in customer support operations and ticket management.",
apps=['zendesk'] # All Zendesk actions will be available
)
# Task to create a new support ticket
create_ticket_task = Task(
description="Create a high-priority support ticket for John Smith who is unable to access his account after password reset",
agent=zendesk_agent,
expected_output="Support ticket created successfully with ticket ID"
)
# Run the task
crew = Crew(
agents=[zendesk_agent],
tasks=[create_ticket_task]
)
crew.kickoff()
from crewai import Agent, Task, Crew
# Create agent with specific Zendesk actions only
support_agent = Agent(
role="Customer Support Agent",
goal="Handle customer inquiries and resolve support issues efficiently",
backstory="An experienced support agent who specializes in ticket resolution and customer communication.",
apps=['zendesk/create_ticket'] # Specific Zendesk actions
)
# Task to manage support workflow
support_task = Task(
description="Create a ticket for login issues, add troubleshooting comments, and update status to resolved",
agent=support_agent,
expected_output="Support ticket managed through complete resolution workflow"
)
crew = Crew(
agents=[support_agent],
tasks=[support_task]
)
crew.kickoff()
from crewai import Agent, Task, Crew
ticket_manager = Agent(
role="Ticket Manager",
goal="Manage support ticket workflows and ensure timely resolution",
backstory="An AI assistant that specializes in support ticket triage and workflow optimization.",
apps=['zendesk']
)
# Task to manage ticket lifecycle
ticket_workflow = Task(
description="""
1. Create a new support ticket for account access issues
2. Add internal notes with troubleshooting steps
3. Update ticket priority based on customer tier
4. Add resolution comments and close the ticket
""",
agent=ticket_manager,
expected_output="Complete ticket lifecycle managed from creation to resolution"
)
crew = Crew(
agents=[ticket_manager],
tasks=[ticket_workflow]
)
crew.kickoff()
from crewai import Agent, Task, Crew
support_analyst = Agent(
role="Support Analyst",
goal="Analyze support metrics and generate insights for team performance",
backstory="An analytical AI that excels at extracting insights from support data and ticket patterns.",
apps=['zendesk']
)
# Complex task involving analytics and reporting
analytics_task = Task(
description="""
1. Search for all open tickets from the last 30 days
2. Analyze ticket resolution times and customer satisfaction
3. Identify common issues and support patterns
4. Generate weekly support performance report
""",
agent=support_analyst,
expected_output="Comprehensive support analytics report with performance insights and recommendations"
)
crew = Crew(
agents=[support_analyst],
tasks=[analytics_task]
)
crew.kickoff()