完成Help Scout渠道的完整功能实现,包含API客户端、webhook处理、轮询同步、自动回复、工单标签分配、客户资料管理等核心能力,附带完整的配置Schema与插件元信息
121 lines
4.6 KiB
Python
121 lines
4.6 KiB
Python
schema = {
|
||
"$schema": "https://json-schema.org/draft-07/schema#",
|
||
"type": "object",
|
||
"title": "Help Scout 渠道配置",
|
||
"description": (
|
||
"配置 Help Scout 客服工单渠道。"
|
||
"建议使用至少 Standard 计划($25/用户/月)以获取 API 访问权限。"
|
||
"Free 计划不支持 API。"
|
||
),
|
||
"properties": {
|
||
"appId": {
|
||
"type": "string",
|
||
"title": "App ID",
|
||
"description": "Help Scout 后台 My Apps → Create My App 获取的 Client ID。",
|
||
},
|
||
"appSecret": {
|
||
"type": "string",
|
||
"title": "App Secret",
|
||
"description": "Help Scout 后台 My Apps 获取的 Client Secret。",
|
||
"x-ui-password": True,
|
||
},
|
||
"mailboxId": {
|
||
"type": "integer",
|
||
"title": "Mailbox ID",
|
||
"description": "监听的 Help Scout 邮箱 ID(在邮箱设置页面 URL 中查看数字 ID)。",
|
||
"minimum": 1,
|
||
},
|
||
"mode": {
|
||
"type": "string",
|
||
"title": "消息接收模式",
|
||
"enum": ["webhook", "polling"],
|
||
"default": "webhook",
|
||
"description": "Webhook(实时推送,需公网 IP)/ Polling(30s 定时轮询,无需公网 IP,备选方案)",
|
||
},
|
||
"webhookUrl": {
|
||
"type": "string",
|
||
"title": "Webhook URL",
|
||
"description": "ForcePilot 暴露的公网回调地址,仅 mode=webhook 时必填。格式:https://your-domain/webhook/helpscout",
|
||
"format": "uri",
|
||
},
|
||
"webhookSecret": {
|
||
"type": "string",
|
||
"title": "Webhook Secret",
|
||
"description": "HMAC-SHA1 签名密钥(≤40 字符),用于验证 Webhook 回调真实性。",
|
||
"x-ui-password": True,
|
||
"maxLength": 40,
|
||
},
|
||
"autoReplyMode": {
|
||
"type": "string",
|
||
"title": "自动回复模式",
|
||
"enum": ["off", "draft", "direct"],
|
||
"default": "draft",
|
||
"description": (
|
||
"off: 不自动回复 / draft: AI 草拟回复→人工审核→发送 / direct: AI 直接发送(⚠️ 谨慎,邮件不可撤回)"
|
||
),
|
||
},
|
||
"customerAllowlist": {
|
||
"type": "array",
|
||
"title": "自动回复客户白名单(邮箱)",
|
||
"description": "仅 autoReplyMode=draft/direct 时生效。留空则所有客户均由 AI 草拟回复。",
|
||
"items": {"type": "string", "format": "email"},
|
||
"default": [],
|
||
},
|
||
"streamingMode": {
|
||
"type": "string",
|
||
"title": "流式输出模式",
|
||
"enum": ["off", "block"],
|
||
"default": "block",
|
||
"description": "Block Streaming:AI 逐块更新草稿内容,人工可在 Help Scout 后台实时查看 AI 正在撰写的回复。",
|
||
},
|
||
"languageDetection": {
|
||
"type": "boolean",
|
||
"title": "客户语言检测",
|
||
"description": "自动检测客户邮件语言,AI 以相同语言回复。",
|
||
"default": True,
|
||
},
|
||
"webhookEvents": {
|
||
"type": "array",
|
||
"title": "Webhook 监听事件",
|
||
"description": "注册到 Help Scout 的 Webhook 事件列表。",
|
||
"items": {
|
||
"type": "string",
|
||
"enum": [
|
||
"convo.created",
|
||
"convo.customer.reply.created",
|
||
"convo.note.created",
|
||
"convo.status",
|
||
"convo.tags",
|
||
"convo.assigned",
|
||
"convo.ai-answers.created",
|
||
"beacon.chat.created",
|
||
"beacon.chat.customer.replied",
|
||
"satisfaction.ratings",
|
||
"customer.created",
|
||
"customer.updated",
|
||
],
|
||
},
|
||
"default": [
|
||
"convo.created",
|
||
"convo.customer.reply.created",
|
||
"convo.note.created",
|
||
"convo.status",
|
||
],
|
||
},
|
||
"autoRegisterWebhook": {
|
||
"type": "boolean",
|
||
"title": "自动注册 Webhook",
|
||
"description": "ForcePilot 启动时自动向 Help Scout API 注册 Webhook。",
|
||
"default": False,
|
||
},
|
||
},
|
||
"required": ["appId", "appSecret", "mailboxId"],
|
||
"requiredOneOf": [
|
||
{
|
||
"description": "当 mode=webhook 时必须填写 webhookUrl 和 webhookSecret",
|
||
"conditions": {"mode": "webhook"},
|
||
"required": ["webhookUrl", "webhookSecret"],
|
||
}
|
||
],
|
||
}
|