{
  "openapi": "3.1.0",
  "info": {
    "title": "3Chat Webhook Event Reference",
    "description": "Structured reference for outbound webhook events sent by 3Chat to developer-configured HTTPS endpoints.",
    "version": "1.0.0"
  },
  "tags": [
    {
      "name": "Dialog/Events",
      "x-displayName": "Dialog Events"
    },
    {
      "name": "Visitor/Events",
      "x-displayName": "Contact Events"
    },
    {
      "name": "Conversation/Events",
      "x-displayName": "Conversation Events"
    },
    {
      "name": "Chat Group/Events",
      "x-displayName": "Chat Group Events"
    },
    {
      "name": "Message/Events",
      "x-displayName": "Message Events"
    }
  ],
  "paths": {},
  "security": [],
  "x-components": {
    "responses": {}
  },
  "components": {
    "schemas": {
      "butlervisitor_sort": {
        "type": "object",
        "properties": {
          "sortOrder": {
            "type": "string",
            "description": "Sort order: use `ASC` for ascending order and `DESC` for descending order.",
            "enum": [
              "ASC",
              "DESC"
            ]
          },
          "sortFieldKey": {
            "type": "string",
            "description": "Sortable fields: totalVisits, updatedTime, lastVisitTime, createdTime, firstVisitTime"
          }
        }
      },
      "butlersession": {
        "type": "object",
        "properties": {
          "updatedTime": {
            "type": "integer",
            "description": "updatedTime, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "workSpaceId": {
            "type": "string",
            "description": "workSpaceId"
          },
          "createdTime": {
            "type": "integer",
            "description": "createdTime, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "visitorId": {
            "type": "string",
            "description": "visitorId"
          }
        }
      },
      "butlersession_sort": {
        "type": "object",
        "properties": {
          "sortOrder": {
            "type": "string",
            "description": "Sort order: use `ASC` for ascending order and `DESC` for descending order.",
            "enum": [
              "ASC",
              "DESC"
            ]
          },
          "sortFieldKey": {
            "type": "string",
            "description": "Sortable fields: updatedTime, createdTime"
          }
        }
      },
      "butlervisitor": {
        "type": "object",
        "properties": {
          "dataId": {
            "type": "string",
            "description": "Visitor data ID"
          },
          "totalVisits": {
            "type": "number",
            "description": "Total visits",
            "format": "double"
          },
          "updatedTime": {
            "type": "integer",
            "description": "Last updated time, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "firstTouch": {
            "type": "string",
            "description": "First-touch information"
          },
          "language": {
            "type": "string",
            "description": "Preferred language"
          },
          "lastTouch": {
            "type": "string",
            "description": "Last-touch information"
          },
          "utmSourceLast": {
            "type": "string",
            "description": "UTM"
          },
          "accountId": {
            "type": "string",
            "description": "accountId"
          },
          "phoneNumber": {
            "type": "string",
            "description": "Phone number"
          },
          "browserAgent": {
            "type": "string",
            "description": "Browser information"
          },
          "lastVisitTime": {
            "type": "integer",
            "description": "Last visit time, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "externalReferrerLast": {
            "type": "string",
            "description": "Source information"
          },
          "name": {
            "type": "string",
            "description": "Name"
          },
          "createdTime": {
            "type": "integer",
            "description": "Creation time, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "lookup_35619bh169": {
            "type": "string",
            "description": "Channel type: chatly=Chatly, openApi=OpenAPI, lazadaSeller=Lazada, wechatPublic=WeChat Official Account, feishu=Feishu, qywechat=WeCom, liveChat=Live Chat, email=Email, unknown=Unknown."
          },
          "lastVisitIp": {
            "type": "string",
            "description": "Last-visit IP address"
          },
          "landingPageLast": {
            "type": "string",
            "description": "Last visited page"
          },
          "lookup_gd40h55ggc": {
            "type": "string",
            "description": "Source channel, 110=Shopify, 10=DingTalk, 11=Feishu, 12=Livechat (old), 13=WeChat Official Account (old), 14=Feishu (old), 15=Lazada (old), 16=openApi (old), 17=WeCom (old), 18=Chatly (old), 19=Unknown, 0=0, 1=WeChat, 101=Email, 2=WeCom, 102=Livechat, 3=WeChat Official Account, 103=WeChat Official Account, 4=WhatsApp, 104=Feishu, 5=WeChat Customer Service, 105=Lazada, 6=TikTok, 106=OpenAPI, 7=Mini Program, 107=WeCom, 8=Douyin, 108=Chatly, 9=Instagram, 109=Unknown, 20=Shopify (old)"
          },
          "email": {
            "type": "string",
            "description": "Email address"
          },
          "firstVisitTime": {
            "type": "integer",
            "description": "First visit time, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "externalUserId": {
            "anyOf": [
              {
                "type": "string",
                "description": "Chatly channel `externalUserId` parameter."
              },
              {
                "type": "null"
              }
            ]
          },
          "botUserId": {
            "anyOf": [
              {
                "type": "string",
                "description": "Chatly channel `botUserId` parameter."
              },
              {
                "type": "null"
              }
            ]
          },
          "imBotId": {
            "anyOf": [
              {
                "type": "string",
                "description": "Chatly channel `imBotId` parameter."
              },
              {
                "type": "null"
              }
            ]
          },
          "orgId": {
            "anyOf": [
              {
                "type": "string",
                "description": "Chatly channel `orgId` parameter."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "dataId"
        ]
      },
      "staff": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Staff name"
          },
          "employeeId": {
            "type": "string",
            "description": "Staff employee number"
          },
          "headPortrait": {
            "type": "string",
            "description": "Staff avatar"
          }
        }
      },
      "staff_filter": {
        "type": "object",
        "properties": {
          "id": {
            "description": "ID (supports multi-value filtering).",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FILTER"
                ]
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "staff_sort": {
        "type": "object",
        "properties": {
          "sortOrder": {
            "type": "string",
            "description": "Sort order: use `ASC` for ascending order and `DESC` for descending order.",
            "enum": [
              "ASC",
              "DESC"
            ]
          },
          "sortFieldKey": {
            "type": "string",
            "description": "Sortable fields: "
          }
        }
      },
      "AccountParam": {
        "type": "object",
        "properties": {
          "account": {
            "anyOf": [
              {
                "type": "string",
                "description": "Account"
              },
              {
                "type": "null"
              }
            ]
          },
          "password": {
            "anyOf": [
              {
                "type": "string",
                "description": "Password"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "account",
          "password"
        ]
      },
      "StaffSaveV3Param": {
        "type": "object",
        "properties": {
          "code": {
            "anyOf": [
              {
                "type": "string",
                "description": "Code"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "anyOf": [
              {
                "type": "string",
                "description": "Name"
              },
              {
                "type": "null"
              }
            ]
          },
          "accountInfo": {
            "$ref": "#/components/schemas/AccountParam",
            "description": "Account information. Optional. If provided, an account is enabled for the staff member; if omitted, the staff member does not have a login account."
          },
          "roleNames": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Role list"
          },
          "departmentNames": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Department list"
          }
        },
        "required": [
          "code",
          "name"
        ]
      },
      "RequestParameterStaffSaveV3Param": {
        "type": "object",
        "properties": {
          "body": {
            "anyOf": [
              {
                "description": "",
                "$ref": "#/components/schemas/StaffSaveV3Param"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "body"
        ]
      },
      "ChannelMessageSendParams": {
        "type": "object",
        "properties": {
          "dialogId": {
            "type": "string",
            "description": "Dialog ID"
          },
          "message": {
            "type": "string",
            "description": "Message content. At least one of `message` and `attachments` must be non-empty."
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AttachmentData",
              "description": "Attachment metadata."
            },
            "description": "Attachment list. At least one of `attachments` and `message` must be non-empty."
          },
          "emailOptions": {
            "$ref": "#/components/schemas/ChannelMessageSendEmailParams",
            "description": ""
          }
        }
      },
      "ChannelMessageSendDTO": {
        "type": "object",
        "properties": {
          "messageId": {
            "type": "string",
            "description": "Message ID"
          }
        }
      },
      "EntityResponseDataChannelMessageSendDTO": {
        "type": "object",
        "properties": {
          "entity": {
            "$ref": "#/components/schemas/ChannelMessageSendDTO",
            "description": ""
          }
        }
      },
      "EntityResponseChannelMessageSendDTO": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": ""
          },
          "message": {
            "type": "string",
            "description": ""
          },
          "data": {
            "$ref": "#/components/schemas/EntityResponseDataChannelMessageSendDTO",
            "description": ""
          }
        }
      },
      "RequestParameterChannelMessageSendParams": {
        "type": "object",
        "properties": {
          "body": {
            "$ref": "#/components/schemas/ChannelMessageSendParams",
            "description": ""
          }
        },
        "required": [
          "body"
        ]
      },
      "AttachmentData": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Attachment name"
          },
          "type": {
            "type": "string",
            "description": "Attachment type. Use a standard HTTP media type: https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types"
          },
          "url": {
            "type": "string",
            "description": "Attachment URL"
          },
          "size": {
            "type": "integer",
            "description": "Attachment size",
            "format": "int64"
          }
        }
      },
      "TransferToHumanParams": {
        "type": "object",
        "properties": {
          "dialogId": {
            "type": "string",
            "description": "Dialog ID"
          }
        }
      },
      "RequestParameterTransferToHumanParams": {
        "type": "object",
        "properties": {
          "body": {
            "$ref": "#/components/schemas/TransferToHumanParams",
            "description": ""
          }
        },
        "required": [
          "body"
        ]
      },
      "ChannelMessageSendEmailParams": {
        "type": "object",
        "properties": {
          "topic": {
            "type": "string",
            "description": "Subject/title used for the email channel."
          },
          "useAttachmentBuffer": {
            "type": "boolean",
            "description": "Whether to send attachment binary data for the email channel. When binary attachment data is included, each attachment must not exceed 10 MB."
          },
          "replyEmailMessageId": {
            "type": "string",
            "description": "Email message ID to reply to."
          }
        }
      },
      "butlermessage_sort": {
        "type": "object",
        "properties": {
          "sortOrder": {
            "type": "string",
            "description": "Sort order: use `ASC` for ascending order and `DESC` for descending order.",
            "enum": [
              "ASC",
              "DESC"
            ]
          },
          "sortFieldKey": {
            "type": "string",
            "description": "Sortable fields: updatedTime, msgType, createdTime"
          }
        }
      },
      "RecipientInfo": {
        "type": "object",
        "properties": {
          "commentId": {
            "anyOf": [
              {
                "type": "string",
                "description": "Comment ID"
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "anyOf": [
              {
                "type": "string",
                "description": "Recipient ID"
              },
              {
                "type": "null"
              }
            ]
          },
          "postId": {
            "anyOf": [
              {
                "type": "string",
                "description": "Post ID"
              },
              {
                "type": "null"
              }
            ]
          },
          "userRef": {
            "anyOf": [
              {
                "type": "string",
                "description": "User reference"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "PrivateMessageSendParams": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "description": "Page ID"
          },
          "recipient": {
            "$ref": "#/components/schemas/RecipientInfo",
            "description": "Recipient information"
          },
          "message": {
            "type": "string",
            "description": "Message content"
          }
        },
        "required": [
          "pageId",
          "recipient",
          "message"
        ]
      },
      "RequestParameter_PrivateMessageSendParams_": {
        "type": "object",
        "properties": {
          "body": {
            "$ref": "#/components/schemas/PrivateMessageSendParams",
            "description": ""
          }
        },
        "required": [
          "body"
        ]
      },
      "CommentReplyParams": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "description": "Page ID"
          },
          "commentId": {
            "type": "string",
            "description": "Comment ID"
          },
          "message": {
            "type": "string",
            "description": "Reply content"
          }
        },
        "required": [
          "pageId",
          "commentId",
          "message"
        ]
      },
      "RequestParameter_CommentReplyParams_": {
        "type": "object",
        "properties": {
          "body": {
            "$ref": "#/components/schemas/CommentReplyParams",
            "description": ""
          }
        },
        "required": [
          "body"
        ]
      },
      "PostDetailParams": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "description": "Page ID"
          },
          "postId": {
            "type": "string",
            "description": "Post ID"
          },
          "fields": {
            "anyOf": [
              {
                "type": "string",
                "description": "Comma-separated list of fields to return. For example: `id,message,created_time,permalink_url,from{id,name},shares,comments,likes,attachments{media_type,media,subattachments}`."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "pageId",
          "postId"
        ]
      },
      "RequestParameter_PostDetailParams_": {
        "type": "object",
        "properties": {
          "body": {
            "$ref": "#/components/schemas/PostDetailParams",
            "description": ""
          }
        },
        "required": [
          "body"
        ]
      },
      "EntityResponseData_Object_": {
        "type": "object",
        "properties": {
          "entity": {
            "$ref": "#/components/schemas/Object",
            "description": ""
          }
        }
      },
      "EntityResponse_Object_": {
        "type": "object",
        "properties": {
          "code": {
            "anyOf": [
              {
                "type": "integer",
                "description": ""
              },
              {
                "type": "null"
              }
            ]
          },
          "message": {
            "anyOf": [
              {
                "type": "string",
                "description": ""
              },
              {
                "type": "null"
              }
            ]
          },
          "data": {
            "$ref": "#/components/schemas/EntityResponseData_Object_",
            "description": ""
          }
        }
      },
      "Object": {
        "type": "object",
        "properties": {}
      },
      "butlerconversation": {
        "type": "object",
        "properties": {
          "convStatus": {
            "type": "string",
            "description": "Status: 2 = active, 3 = completed."
          },
          "summary": {
            "type": "string",
            "description": "Current conversation summary"
          },
          "updatedTime": {
            "type": "integer",
            "description": "Last updated time, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "replyStrategy": {
            "type": "string",
            "description": "Reply strategy: 1 = human agent; 2 = 3Chat AI Agent; 3 = contact/visitor."
          },
          "completedTime": {
            "type": "integer",
            "description": "Closed time, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "solved": {
            "type": "boolean",
            "description": "Resolved status. `true` = resolved; `false` = unresolved."
          },
          "ratingComment": {
            "type": "string",
            "description": "Contact rating"
          },
          "lookup_3g71fgh5f5": {
            "type": "string",
            "description": "Contact name"
          },
          "duration": {
            "type": "number",
            "description": "Conversation duration",
            "format": "double"
          },
          "dataId": {
            "type": "string",
            "description": "Database ID"
          },
          "userAccountId": {
            "type": "string",
            "description": "Visitor platform ID"
          },
          "createdTime": {
            "type": "integer",
            "description": "Creation time, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "lookup_h70b811f83": {
            "type": "string",
            "description": "Channel type (new), 110=Shopify, 111=Facebook, 112=Instagram, 113=Sandbox, 114=SHOPLINE, 10=DingTalk, 11=Feishu, 12=Xiaohongshu (RED), 13=WeChat Official Account (old), 14=Feishu (old), 15=Lazada (old), 16=openApi (old), 17=WeCom (old), 18=Chatly (old), 19=Unknown, 0=0, 1=WeChat, 101=Email, 2=WeCom, 102=Livechat, 3=WeChat Official Account, 103=WeChat Official Account, 4=WhatsApp, 104=Feishu, 5=WeChat Customer Service, 105=Lazada, 6=TikTok, 106=OpenAPI, 7=WeChat Mini Program, 107=WeCom, 8=Douyin, 108=Chatly, 9=Instagram, 109=Unknown, 20=Shopify (old)"
          },
          "ratingLevels": {
            "type": "string",
            "description": "Rating: 1, 2, 3, 4, or 5."
          },
          "lookup_02fghe5910": {
            "type": "string",
            "description": "Contact email address"
          },
          "solverType": {
            "type": "string",
            "description": "Resolver: 1 = 3Chat; 2 = human agent."
          }
        }
      },
      "butlerconversation_sort": {
        "type": "object",
        "properties": {
          "sortOrder": {
            "type": "string",
            "description": "Sort order: use `ASC` for ascending order and `DESC` for descending order.",
            "enum": [
              "ASC",
              "DESC"
            ]
          },
          "sortFieldKey": {
            "type": "string",
            "description": "Sortable fields: duration, updatedTime, completedTime, createdTime"
          }
        }
      },
      "butlerchannel": {
        "type": "object",
        "properties": {
          "updatedTime": {
            "type": "integer",
            "description": "updatedTime, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "weChatPublicAppId": {
            "type": "string",
            "description": "weChatPublicAppId"
          },
          "appName": {
            "type": "string",
            "description": "appName"
          },
          "accountType": {
            "type": "string",
            "description": "accountType: [110=Shopify, 111=Facebook, 112=Instagram, 113=Sandbox, 114=SHOPLINE, 10=DingTalk, 11=Feishu, 12=Xiaohongshu (RED), 13=WeChat Official Account (old), 14=Feishu (old), 15=Lazada (old), 16=openApi (old), 17=WeCom (old), 18=Chatly (old), 19=Unknown, 0=0, 1=WeChat, 101=Email address, 2=WeCom, 102=Livechat, 3=WeChat Official Account, 103=WeChat Official Account, 4=WhatsApp, 104=Feishu, 5=WeChat Customer Service, 105=Lazada, 6=TikTok, 106=OpenAPI, 7=WeChat Mini Program, 107=WeCom, 8=Douyin, 108=Chatly, 9=Instagram, 109=Unknown, 20=Shopify (old)]"
          },
          "type": {
            "type": "string",
            "description": "type: [chatly=Chatly, openApi=OpenAPI, lazadaSeller=Lazada, wechatPublic=WeChat Official Account, feishu=Feishu, qywechat=WeCom, liveChat=Live Chat, email=Email, meta=Facebook, instagram=Instagram, sandbox=Sandbox, unknown=Unknown]"
          },
          "accessToken": {
            "type": "string",
            "description": "accessToken"
          },
          "feishuAppId": {
            "type": "string",
            "description": "feishuAppId"
          },
          "dataId": {
            "type": "string",
            "description": "dataId"
          },
          "feishuSecret": {
            "type": "string",
            "description": "feishuSecret"
          },
          "authorizerRefreshToken": {
            "type": "string",
            "description": "authorizerRefreshToken"
          },
          "feishuTenantAccessToken": {
            "type": "string",
            "description": "feishuTenantAccessToken"
          },
          "workSpaceId": {
            "type": "string",
            "description": "workSpaceId"
          },
          "createdTime": {
            "type": "integer",
            "description": "createdTime, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "lazadaSellerId": {
            "type": "string",
            "description": "lazadaSellerId"
          },
          "liveChatType": {
            "type": "string",
            "description": "liveChatType: [shopify=Shopify, official=Official Website, shopline=SHOPLINE, shared=Shared Link]"
          }
        }
      },
      "butlerchannel_filter": {
        "type": "object",
        "properties": {
          "updatedTime": {
            "description": "updatedTime, Unix timestamp in milliseconds (time-range filter).",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "TIME_RANGE"
                ]
              },
              "timeRange": {
                "type": "object",
                "properties": {
                  "start": {
                    "type": "integer",
                    "format": "int64",
                    "description": "Start time, Unix timestamp in milliseconds."
                  },
                  "end": {
                    "type": "integer",
                    "format": "int64",
                    "description": "End time, Unix timestamp in milliseconds."
                  }
                },
                "description": ""
              }
            }
          },
          "weChatPublicAppId": {
            "description": "weChatPublicAppId (supports fuzzy, exact, and multi-value filtering)",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FUZZY",
                  "KEYWORD",
                  "FILTER"
                ]
              },
              "value": {
                "type": "string",
                "description": ""
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "appName": {
            "description": "appName (supports fuzzy, exact, and multi-value filtering)",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FUZZY",
                  "KEYWORD",
                  "FILTER"
                ]
              },
              "value": {
                "type": "string",
                "description": ""
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "accountType": {
            "description": "accountType, 110=Shopify, 111=Facebook, 112=Instagram, 113=Sandbox, 114=SHOPLINE, 10=DingTalk, 11=Feishu, 12=Xiaohongshu (RED), 13=WeChat Official Account (old), 14=Feishu (old), 15=Lazada (old), 16=openApi (old), 17=WeCom (old), 18=Chatly (old), 19=Unknown, 0=0, 1=WeChat, 101=Email, 2=WeCom, 102=Livechat, 3=WeChat Official Account, 103=WeChat Official Account, 4=WhatsApp, 104=Feishu, 5=WeChat Customer Service, 105=Lazada, 6=TikTok, 106=OpenAPI, 7=WeChat Mini Program, 107=WeCom, 8=Douyin, 108=Chatly, 9=Instagram, 109=Unknown, 20=Shopify (old) (supports multi-value filtering)",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FILTER"
                ]
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "type": {
            "description": "type: chatly=Chatly, openApi=OpenAPI, lazadaSeller=Lazada, wechatPublic=WeChat Official Account, feishu=Feishu, qywechat=WeCom, liveChat=Live Chat, email=Email, unknown=Unknown. Supports multi-value filtering.",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FILTER"
                ]
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "accessToken": {
            "description": "accessToken (supports fuzzy, exact, and multi-value filtering)",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FUZZY",
                  "KEYWORD",
                  "FILTER"
                ]
              },
              "value": {
                "type": "string",
                "description": ""
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "feishuAppId": {
            "description": "feishuAppId (supports fuzzy, exact, and multi-value filtering)",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FUZZY",
                  "KEYWORD",
                  "FILTER"
                ]
              },
              "value": {
                "type": "string",
                "description": ""
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "dataId": {
            "description": "dataId (supports fuzzy, exact, and multi-value filtering)",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FUZZY",
                  "KEYWORD",
                  "FILTER"
                ]
              },
              "value": {
                "type": "string",
                "description": ""
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "feishuSecret": {
            "description": "feishuSecret (supports fuzzy, exact, and multi-value filtering)",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FUZZY",
                  "KEYWORD",
                  "FILTER"
                ]
              },
              "value": {
                "type": "string",
                "description": ""
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "authorizerRefreshToken": {
            "description": "authorizerRefreshToken (supports fuzzy, exact, and multi-value filtering)",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FUZZY",
                  "KEYWORD",
                  "FILTER"
                ]
              },
              "value": {
                "type": "string",
                "description": ""
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "feishuTenantAccessToken": {
            "description": "feishuTenantAccessToken (supports fuzzy, exact, and multi-value filtering)",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FUZZY",
                  "KEYWORD",
                  "FILTER"
                ]
              },
              "value": {
                "type": "string",
                "description": ""
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "workSpaceId": {
            "description": "workSpaceId (supports fuzzy, exact, and multi-value filtering)",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FUZZY",
                  "KEYWORD",
                  "FILTER"
                ]
              },
              "value": {
                "type": "string",
                "description": ""
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "createdTime": {
            "description": "createdTime, Unix timestamp in milliseconds (time-range filter).",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "TIME_RANGE"
                ]
              },
              "timeRange": {
                "type": "object",
                "properties": {
                  "start": {
                    "type": "integer",
                    "format": "int64",
                    "description": "Start time, Unix timestamp in milliseconds."
                  },
                  "end": {
                    "type": "integer",
                    "format": "int64",
                    "description": "End time, Unix timestamp in milliseconds."
                  }
                },
                "description": ""
              }
            }
          },
          "lazadaSellerId": {
            "description": "lazadaSellerId (supports fuzzy, exact, and multi-value filtering)",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FUZZY",
                  "KEYWORD",
                  "FILTER"
                ]
              },
              "value": {
                "type": "string",
                "description": ""
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "liveChatType": {
            "description": "liveChatType: shopify=Shopify, official=Official Website, shopline=SHOPLINE. Supports multi-value filtering.",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FILTER"
                ]
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "id": {
            "description": "ID (supports multi-value filtering).",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FILTER"
                ]
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "butlerchannel_sort": {
        "type": "object",
        "properties": {
          "sortOrder": {
            "type": "string",
            "description": "Sort order: use `ASC` for ascending order and `DESC` for descending order.",
            "enum": [
              "ASC",
              "DESC"
            ]
          },
          "sortFieldKey": {
            "type": "string",
            "description": "Sortable fields: updatedTime, createdTime"
          }
        }
      },
      "butlermessage": {
        "type": "object",
        "properties": {
          "updatedTime": {
            "type": "integer",
            "description": "updatedTime, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "createdTime": {
            "type": "integer",
            "description": "createdTime, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "senderId": {
            "type": "integer",
            "description": "Sender ID. If `senderType==1`, `senderId` is the contact ID; if `senderType==2`, it is the platform sender ID; if `senderType==3`, it is the Agent ID."
          },
          "workSpaceId": {
            "type": "string",
            "description": "workSpaceId"
          },
          "senderType": {
            "type": "integer",
            "description": "senderType: -1 = unknown; 0 = system; 1 = contact (customer); 2 = human agent; 3 = 3Chat Agent."
          },
          "isEffectiveReply": {
            "type": "boolean",
            "description": "isEffectiveReply: `true` = yes; `false` = no."
          },
          "email": {
            "type": "object",
            "description": "email",
            "properties": {
              "from": {
                "type": "string",
                "description": "Sender address"
              },
              "fromName": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "Sender name"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "to": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Recipient address array"
              },
              "cc": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "CC address array"
              },
              "bcc": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "BCC address array"
              },
              "subject": {
                "type": "string",
                "description": "Email subject"
              }
            },
            "required": [
              "from",
              "to",
              "cc",
              "bcc",
              "subject"
            ]
          },
          "content": {
            "type": "string",
            "description": "content"
          },
          "id": {
            "type": "string",
            "description": "Unique entry ID"
          },
          "dataId": {
            "type": "string",
            "description": "Database ID"
          },
          "sessionId": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "Dialog ID"
              },
              "viewKey": {
                "type": "string",
                "description": "View entity key"
              }
            },
            "description": "Dialog ID; equivalent to `dialogId`.",
            "required": [
              "id",
              "viewKey"
            ]
          },
          "conversationId": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "Conversation ID"
              },
              "viewKey": {
                "type": "string",
                "description": "View entity key"
              }
            },
            "description": "Conversation ID",
            "required": [
              "id",
              "viewKey"
            ]
          },
          "channelId": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "Channel ID"
              },
              "viewKey": {
                "type": "string",
                "description": "View entity key"
              }
            },
            "description": "Channel ID",
            "required": [
              "id",
              "viewKey"
            ]
          },
          "attachments": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "contentType": {
                      "type": "string",
                      "description": "Attachment MIME type"
                    },
                    "url": {
                      "type": "string",
                      "description": "Attachment URL"
                    },
                    "size": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "description": "Attachment size"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "name",
                    "contentType",
                    "url"
                  ]
                },
                "description": "Attachment array"
              },
              {
                "type": "null"
              }
            ]
          },
          "extendMap": {
            "type": "object",
            "properties": {},
            "description": "Custom fields"
          },
          "agentLogs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "Log type: `language` (language detection) | `recall` (memory recall) | `task` (intent/task selection) | `knowledge` (Knowledge Base retrieval) | `tool` (MCP tool call) | `internalTool` (internal tool call) | `systemTask` (special system task)."
                },
                "name": {
                  "type": "string",
                  "description": "Tool or task name"
                },
                "message": {
                  "type": "string",
                  "description": "Log content"
                },
                "status": {
                  "type": "string",
                  "description": "Language-detection status or tool execution status"
                },
                "kb": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "content": {
                        "type": "string",
                        "description": "Knowledge Base chunk content"
                      },
                      "chunk_id": {
                        "type": "string",
                        "description": "Chunk ID"
                      },
                      "document_id": {
                        "type": "string",
                        "description": "Knowledge Base document ID"
                      },
                      "document_name": {
                        "type": "string",
                        "description": "Knowledge Base document name"
                      },
                      "enabled": {
                        "type": "boolean",
                        "description": "Whether enabled."
                      },
                      "lang": {
                        "type": "string",
                        "description": "Knowledge Base language"
                      },
                      "score": {
                        "type": "number",
                        "description": "Retrieval score"
                      },
                      "source": {
                        "type": "string",
                        "description": "Source: Document | FAQ | Sample (generated example) | Website content."
                      },
                      "created_at": {
                        "type": "integer",
                        "description": "Knowledge Base creation time"
                      }
                    },
                    "required": [
                      "document_id",
                      "enabled"
                    ]
                  },
                  "description": "Referenced Knowledge Base"
                },
                "entity": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "Entity name"
                    },
                    "values": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {},
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "description": "Entity value"
                    }
                  },
                  "description": "Internal entity invocation",
                  "required": [
                    "name"
                  ]
                },
                "timestamp": {
                  "type": "integer",
                  "description": "Log timestamp"
                }
              },
              "description": "Agent activity log content",
              "required": [
                "type",
                "timestamp"
              ]
            },
            "description": "Agent activity logs"
          },
          "processedBy": {
            "type": "string",
            "description": "Indicates how the message was answered: `HUMAN_AGENT` = human reply; `AI_AGENT` = AI reply; `UNKNOWN` = unclassified."
          }
        },
        "required": [
          "id",
          "sessionId",
          "conversationId",
          "channelId",
          "extendMap",
          "dataId"
        ]
      },
      "ChatDTO": {
        "type": "object",
        "properties": {
          "dialogId": {
            "type": "string",
            "description": "Dialog ID"
          },
          "agentLogs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "Log type: `language` (language detection) | `recall` (memory recall) | `task` (intent/task selection) | `knowledge` (Knowledge Base retrieval) | `tool` (MCP tool call) | `internalTool` (internal tool call) | `systemTask` (special system task)."
                },
                "name": {
                  "type": "string",
                  "description": "Tool or task name"
                },
                "message": {
                  "type": "string",
                  "description": "Log content"
                },
                "status": {
                  "type": "string",
                  "description": "Language-detection status or tool execution status"
                },
                "kb": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "content": {
                        "type": "string",
                        "description": "Knowledge Base chunk content"
                      },
                      "chunk_id": {
                        "type": "string",
                        "description": "Chunk ID"
                      },
                      "document_id": {
                        "type": "string",
                        "description": "Knowledge Base document ID"
                      },
                      "document_name": {
                        "type": "string",
                        "description": "Knowledge Base document name"
                      },
                      "enabled": {
                        "type": "boolean",
                        "description": "Whether enabled."
                      },
                      "lang": {
                        "type": "string",
                        "description": "Knowledge Base language"
                      },
                      "score": {
                        "type": "number",
                        "description": "Retrieval score"
                      },
                      "source": {
                        "type": "string",
                        "description": "Source: Document | FAQ | Sample (generated example) | Website content."
                      },
                      "created_at": {
                        "type": "integer",
                        "description": "Knowledge Base creation time"
                      }
                    },
                    "required": [
                      "document_id",
                      "enabled"
                    ]
                  },
                  "description": "Referenced Knowledge Base"
                },
                "entity": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "Entity name"
                    },
                    "values": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {},
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "description": "Entity value"
                    }
                  },
                  "description": "Internal entity invocation",
                  "required": [
                    "name"
                  ]
                },
                "timestamp": {
                  "type": "integer",
                  "description": "Log timestamp"
                }
              },
              "description": "Agent activity log content",
              "required": [
                "type",
                "timestamp"
              ]
            },
            "description": "Agent activity logs"
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "Primary content type.\nUsed by clients to select the appropriate rendering component.\nAllowed values:\n- `text`: Plain text\n- `image`: Image\n- `audio`: Audio\n- `video`: Video\n- `file`: File or attachment"
                },
                "contentType": {
                  "type": "string",
                  "description": "Media format (MIME type), using standard IANA media types.\nExamples:\n- Text: `text/plain`\n- Image: `image/jpeg`, `image/png`\n- Audio/video: `audio/mpeg`, `video/mp4`\nUsed by players and browsers to determine how the resource should be decoded or rendered."
                },
                "text": {
                  "type": "string",
                  "description": "Display text / fallback text.\n- When `type=text`, this is the primary message content and supports Markdown.\n- When `type=image`, `audio`, or `video`, this value acts as alt text or the file name. Clients that cannot render the media should display this text instead."
                },
                "url": {
                  "type": "string",
                  "description": "Resource URL.\n- When `type=text`, this is an empty string or `null`.\n- For other types, this is the CDN URL used to access or download the media file."
                },
                "meta": {
                  "type": "object",
                  "properties": {
                    "width": {
                      "type": "number",
                      "description": "Applies to `image`: image width in pixels. Clients can use this value to reserve layout space before the image loads."
                    },
                    "height": {
                      "type": "number",
                      "description": "Applies to `image`: image height in pixels."
                    },
                    "size_kb": {
                      "type": "number",
                      "description": "Applies to `image`/`file`: file size in KB, used for loading estimates or data-usage hints."
                    },
                    "duration": {
                      "type": "number",
                      "description": "Applies to `audio`/`video`: media duration in seconds, which can be used to render the progress bar before the media finishes loading."
                    },
                    "format": {
                      "type": "string",
                      "description": "Applies to `audio`/`video`: file extension. Some legacy players may use this value to identify the media format."
                    },
                    "coverUrl": {
                      "type": "string",
                      "description": "Applies to `video`: optional video poster/thumbnail URL."
                    }
                  },
                  "description": "Metadata containing non-business attributes of the media resource."
                }
              },
              "description": "Agent message content"
            },
            "description": "Agent message list"
          }
        }
      },
      "EntityResponseChatDTO": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": ""
          },
          "message": {
            "type": "string",
            "description": ""
          },
          "data": {
            "$ref": "#/components/schemas/ChatDTO"
          }
        }
      },
      "CertifyResponseDTO": {
        "type": "object",
        "properties": {
          "staffId": {
            "type": "integer",
            "description": "staff id\nStaff ID",
            "format": "int64"
          },
          "tenantId": {
            "type": "string",
            "description": "Tenant ID"
          },
          "agent": {
            "type": "string",
            "description": "Device type",
            "enum": [
              "WEB",
              "APP",
              "PAD",
              "BOARD",
              "OTHER",
              "FEISHU",
              "WECOM",
              "DINGTALK"
            ]
          }
        }
      },
      "EntityResponseDataCertifyResponseDTO": {
        "type": "object",
        "properties": {
          "entity": {
            "$ref": "#/components/schemas/CertifyResponseDTO",
            "description": ""
          }
        }
      },
      "EntityResponseCertifyResponseDTO": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": ""
          },
          "message": {
            "type": "string",
            "description": ""
          },
          "data": {
            "$ref": "#/components/schemas/EntityResponseDataCertifyResponseDTO",
            "description": ""
          }
        }
      },
      "CertifyParams": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "description": "HTTP method",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "DELETE"
            ]
          },
          "uri": {
            "type": "string",
            "description": "Request URL"
          },
          "session": {
            "type": "string",
            "description": "Session ID"
          },
          "token": {
            "type": "string",
            "description": "Token"
          }
        },
        "required": [
          "method",
          "uri"
        ]
      },
      "TokenRequest": {
        "type": "object",
        "properties": {
          "appKey": {
            "type": "string",
            "description": "App key"
          },
          "appSecret": {
            "type": "string",
            "description": "App secret"
          }
        },
        "required": [
          "appKey",
          "appSecret"
        ]
      },
      "OpenApiTokenDTO": {
        "type": "object",
        "properties": {
          "accessToken": {
            "type": "string",
            "description": "Credential"
          },
          "accessTokenExpireIn": {
            "type": "integer",
            "description": "Credential expiration time",
            "format": "int64"
          },
          "refreshToken": {
            "type": "string",
            "description": "Refresh token"
          },
          "refreshTokenExpireIn": {
            "type": "integer",
            "description": "Refresh-token expiration time",
            "format": "int64"
          }
        }
      },
      "EntityResponseDataOpenApiTokenDTO": {
        "type": "object",
        "properties": {
          "entity": {
            "$ref": "#/components/schemas/OpenApiTokenDTO",
            "description": ""
          }
        }
      },
      "EntityResponseOpenApiTokenDTO": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": ""
          },
          "message": {
            "type": "string",
            "description": ""
          },
          "data": {
            "$ref": "#/components/schemas/EntityResponseDataOpenApiTokenDTO",
            "description": ""
          }
        }
      },
      "RequestParameterTokenRequest": {
        "type": "object",
        "properties": {
          "body": {
            "$ref": "#/components/schemas/TokenRequest",
            "description": ""
          }
        },
        "required": [
          "body"
        ]
      },
      "TokenRefresh": {
        "type": "object",
        "properties": {
          "refreshToken": {
            "type": "string",
            "description": "Refresh Token"
          }
        },
        "required": [
          "refreshToken"
        ]
      },
      "RequestParameterTokenRefresh": {
        "type": "object",
        "properties": {
          "body": {
            "$ref": "#/components/schemas/TokenRefresh",
            "description": ""
          }
        },
        "required": [
          "body"
        ]
      },
      "department_staff_relation": {
        "type": "object",
        "properties": {
          "createTime": {
            "type": "integer",
            "description": "Creation time, Unix timestamp in milliseconds.",
            "format": "int64"
          },
          "departmentId": {
            "type": "string",
            "description": "Department"
          },
          "inCharge": {
            "type": "boolean",
            "description": "Whether this staff member is the owner. `true` = yes; `false` = no."
          },
          "staffId": {
            "type": "string",
            "description": "Staff member"
          }
        }
      },
      "department_staff_relation_filter": {
        "type": "object",
        "properties": {
          "id": {
            "description": "ID (supports multi-value filtering).",
            "type": "object",
            "required": [
              "conditionType"
            ],
            "properties": {
              "conditionType": {
                "type": "string",
                "description": "{FUZZY=fuzzy-match filtering, KEYWORD=exact-match filtering, FILTER=multi-value filtering, TIME_RANGE=time-range filtering}",
                "enum": [
                  "FILTER"
                ]
              },
              "filter": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "department_staff_relation_sort": {
        "type": "object",
        "properties": {
          "sortOrder": {
            "type": "string",
            "description": "Sort order: use `ASC` for ascending order and `DESC` for descending order.",
            "enum": [
              "ASC",
              "DESC"
            ]
          },
          "sortFieldKey": {
            "type": "string",
            "description": "Sortable fields: "
          }
        }
      },
      "KnowledgeDeleteParams": {
        "type": "object",
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of Knowledge Base IDs to delete."
          }
        },
        "required": [
          "ids"
        ]
      },
      "ConversationClosedParams": {
        "type": "object",
        "properties": {
          "conversationId": {
            "type": "string",
            "description": "Dialog ID"
          },
          "dialogId": {
            "type": "string",
            "description": "Conversation ID"
          }
        }
      },
      "AgentEnableParams": {
        "type": "object",
        "properties": {
          "enable": {
            "type": "boolean",
            "description": "Whether the Agent is deployed/enabled. `true` = enabled; `false` = disabled."
          }
        },
        "required": [
          "enable"
        ]
      },
      "BaseResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": ""
          },
          "message": {
            "type": "string",
            "description": ""
          }
        }
      },
      "butlergroup_sort": {
        "type": "object",
        "properties": {
          "sortOrder": {
            "type": "string",
            "description": "Sort order: use `ASC` for ascending order and `DESC` for descending order.",
            "enum": [
              "ASC",
              "DESC"
            ]
          },
          "sortFieldKey": {
            "type": "string",
            "description": "Sortable fields: updatedTime, createdTime"
          }
        }
      },
      "WebhookEntityId": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Entity ID."
          }
        }
      },
      "DialogCreatedWebhookData": {
        "type": "object",
        "description": "Dialog data included in the Dialog Created event.",
        "properties": {
          "id": {
            "type": "string",
            "example": "sess_p2p_001"
          },
          "workSpaceId": {
            "type": "string",
            "example": "ws_001"
          },
          "type": {
            "type": "string",
            "example": "p2p"
          },
          "channelId": {
            "$ref": "#/components/schemas/WebhookEntityId",
            "example": {
              "id": "ch_livechat_01"
            }
          },
          "visitorId": {
            "$ref": "#/components/schemas/WebhookEntityId",
            "example": {
              "id": "visitor_123"
            }
          },
          "lastMessageId": {
            "$ref": "#/components/schemas/WebhookEntityId",
            "example": {
              "id": "msg_202"
            }
          },
          "createdTime": {
            "type": "integer",
            "example": 1690000000,
            "format": "int64"
          },
          "updatedTime": {
            "type": "integer",
            "example": 1690003600,
            "format": "int64"
          }
        }
      },
      "DialogCreatedWebhookEvent": {
        "type": "object",
        "required": [
          "requestId",
          "businessType",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Unique ID of this webhook delivery.",
            "example": "03703d30-50f2-4103-bdb6-8aa331f36cc5"
          },
          "businessType": {
            "type": "integer",
            "description": "Business type code. 15013 represents the Dialog Created event.",
            "example": 15013
          },
          "data": {
            "$ref": "#/components/schemas/DialogCreatedWebhookData"
          }
        },
        "example": {
          "requestId": "03703d30-50f2-4103-bdb6-8aa331f36cc5",
          "businessType": 15013,
          "data": {
            "id": "sess_p2p_001",
            "workSpaceId": "ws_001",
            "type": "p2p",
            "channelId": {
              "id": "ch_livechat_01"
            },
            "visitorId": {
              "id": "visitor_123"
            },
            "lastMessageId": {
              "id": "msg_202"
            },
            "createdTime": 1690000000,
            "updatedTime": 1690003600
          }
        }
      },
      "ContactWebhookData": {
        "type": "object",
        "description": "The contact record included in a contact webhook event.",
        "required": [
          "id",
          "workSpaceId",
          "channelId",
          "createdTime",
          "updatedTime"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Globally unique identifier of the contact.",
            "example": "visitor_001"
          },
          "workSpaceId": {
            "type": "string",
            "description": "Identifier of the 3Chat Workspace that owns the contact.",
            "example": "ws_abc"
          },
          "channelId": {
            "type": "string",
            "description": "Identifier of the channel associated with the contact.",
            "example": "ch_livechat_01"
          },
          "name": {
            "type": "string",
            "description": "Display name of the contact.",
            "example": "Wang Xiaoming"
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Email address of the contact.",
            "example": "xiaoming.wang@example.com"
          },
          "phoneNumber": {
            "type": "string",
            "description": "Phone number of the contact.",
            "example": "+86-13800138000"
          },
          "language": {
            "type": "string",
            "description": "Preferred language of the contact.",
            "example": "zh-CN"
          },
          "accountId": {
            "type": "string",
            "description": "Platform account identifier. Its meaning depends on the channel; for an IM channel, it identifies the corresponding IM contact.",
            "example": "acc_1001"
          },
          "lastVisitIp": {
            "type": "string",
            "description": "IP address recorded for the contact's most recent visit.",
            "example": "203.0.113.45"
          },
          "browserAgent": {
            "type": "string",
            "description": "Browser user-agent string recorded for the contact.",
            "example": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)"
          },
          "fistTouch": {
            "type": "string",
            "description": "URL of the contact's first recorded touchpoint. The field name is retained as `fistTouch` for payload compatibility.",
            "example": "https://example.com/landing?utm=campaign"
          },
          "lastTouch": {
            "type": "string",
            "description": "URL of the contact's most recent touchpoint.",
            "example": "https://example.com/product/1"
          },
          "externalReferrerLast": {
            "type": "string",
            "description": "Most recent external referrer recorded for the contact.",
            "example": "google.com"
          },
          "landingPageLast": {
            "type": "string",
            "description": "Path of the contact's most recent landing page.",
            "example": "/product/1"
          },
          "utmSourceLast": {
            "type": "string",
            "description": "Most recent UTM source recorded for the contact.",
            "example": "newsletter"
          },
          "firstVisitTime": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in seconds, of the contact's first visit.",
            "example": 1690000000
          },
          "lastVisitTime": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in seconds, of the contact's most recent visit.",
            "example": 1690003600
          },
          "totalVisits": {
            "type": "integer",
            "description": "Total number of recorded visits.",
            "example": 5
          },
          "externalUserId": {
            "type": "string",
            "description": "External user identifier supplied by the connected IM platform, when applicable.",
            "example": "wo56kvDgAA5VmZqvgsX8d-cDmSDXCZXQ"
          },
          "botUserId": {
            "type": "string",
            "description": "Identifier of the managed account member on the connected IM platform, when applicable.",
            "example": "abc@xinheyun.com"
          },
          "imBotId": {
            "type": "string",
            "description": "Identifier of the managed IM bot or account, when applicable.",
            "example": "1688856053740892"
          },
          "orgId": {
            "type": "string",
            "description": "Organization identifier supplied by the connected IM platform, when applicable.",
            "example": "6887410937e2124b6d6265a1"
          },
          "createdTime": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in seconds, when the contact record was created.",
            "example": 1690000000
          },
          "updatedTime": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in seconds, when the contact record was last updated.",
            "example": 1690003600
          },
          "extendMap": {
            "type": "object",
            "description": "Custom fields associated with the contact.",
            "additionalProperties": true,
            "example": {
              "preferredContact": "email",
              "customerTier": "gold"
            }
          }
        }
      },
      "ContactCreatedWebhookEvent": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "businessType",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for this webhook delivery.",
            "example": "03703d30-50f2-4103-bdb6-8aa331f36cc5"
          },
          "businessType": {
            "type": "integer",
            "description": "Business type code. The value is 15009 for Contact Created.",
            "const": 15009,
            "example": 15009
          },
          "data": {
            "$ref": "#/components/schemas/ContactWebhookData"
          }
        },
        "example": {
          "requestId": "03703d30-50f2-4103-bdb6-8aa331f36cc5",
          "businessType": 15009,
          "data": {
            "id": "visitor_001",
            "workSpaceId": "ws_abc",
            "channelId": "ch_livechat_01",
            "name": "Wang Xiaoming",
            "email": "xiaoming.wang@example.com",
            "phoneNumber": "+86-13800138000",
            "language": "zh-CN",
            "accountId": "acc_1001",
            "lastVisitIp": "203.0.113.45",
            "browserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
            "fistTouch": "https://example.com/landing?utm=campaign",
            "lastTouch": "https://example.com/product/1",
            "externalReferrerLast": "google.com",
            "landingPageLast": "/product/1",
            "utmSourceLast": "newsletter",
            "firstVisitTime": 1690000000,
            "lastVisitTime": 1690003600,
            "totalVisits": 5,
            "externalUserId": "wo56kvDgAA5VmZqvgsX8d-cDmSDXCZXQ",
            "botUserId": "abc@xinheyun.com",
            "imBotId": "1688856053740892",
            "orgId": "6887410937e2124b6d6265a1",
            "createdTime": 1690000000,
            "updatedTime": 1690003600,
            "extendMap": {
              "preferredContact": "email",
              "customerTier": "gold"
            }
          }
        }
      },
      "ContactUpdatedWebhookEvent": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "businessType",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for this webhook delivery.",
            "example": "03703d30-50f2-4103-bdb6-8aa331f36cc5"
          },
          "businessType": {
            "type": "integer",
            "description": "Business type code. The value is 15010 for Contact Updated.",
            "const": 15010,
            "example": 15010
          },
          "data": {
            "$ref": "#/components/schemas/ContactWebhookData"
          }
        },
        "example": {
          "requestId": "03703d30-50f2-4103-bdb6-8aa331f36cc5",
          "businessType": 15010,
          "data": {
            "id": "visitor_001",
            "workSpaceId": "ws_abc",
            "channelId": "ch_livechat_01",
            "name": "Wang Xiaoming",
            "email": "xiaoming.wang@example.com",
            "phoneNumber": "+86-13800138000",
            "language": "zh-CN",
            "accountId": "acc_1001",
            "lastVisitIp": "203.0.113.45",
            "browserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
            "fistTouch": "https://example.com/landing?utm=campaign",
            "lastTouch": "https://example.com/product/1",
            "externalReferrerLast": "google.com",
            "landingPageLast": "/product/1",
            "utmSourceLast": "newsletter",
            "firstVisitTime": 1690000000,
            "lastVisitTime": 1690003600,
            "totalVisits": 5,
            "externalUserId": "wo56kvDgAA5VmZqvgsX8d-cDmSDXCZXQ",
            "botUserId": "abc@xinheyun.com",
            "imBotId": "1688856053740892",
            "orgId": "6887410937e2124b6d6265a1",
            "createdTime": 1690000000,
            "updatedTime": 1690003600,
            "extendMap": {
              "preferredContact": "email",
              "customerTier": "gold"
            }
          }
        }
      },
      "WebhookEntityReference": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "viewKey"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier of the referenced entity."
          },
          "viewKey": {
            "type": "string",
            "description": "Entity view key used by 3Chat."
          }
        }
      },
      "ConversationWebhookData": {
        "type": "object",
        "description": "The Conversation record included in the webhook event.",
        "required": [
          "id",
          "dataId",
          "convStatus",
          "replyStrategy",
          "sessionId",
          "visitorId",
          "createdTime",
          "updatedTime"
        ],
        "properties": {
          "summary": {
            "type": "string",
            "description": "Summary of the main inquiry and the handling process for this Conversation.",
            "example": "The contact asked about the Xiaomi 15 experience and purchasing options. The AI gathered the contact’s priorities, escalated the Conversation to a human agent, and confirmed the contact details for follow-up."
          },
          "convStatus": {
            "type": "integer",
            "description": "Conversation status. `2` means active and `3` means completed.",
            "enum": [
              2,
              3
            ],
            "example": 3
          },
          "updatedTime": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in milliseconds, when the Conversation was last updated.",
            "example": 1765466070910
          },
          "completedTime": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64",
                "description": "Unix timestamp, in milliseconds, when the Conversation was completed."
              },
              {
                "type": "null"
              }
            ],
            "example": 1765466070908
          },
          "replyStrategy": {
            "type": "integer",
            "description": "Current reply strategy. `1` means human agent, `2` means AI agent, and `3` means contact.",
            "enum": [
              1,
              2,
              3
            ],
            "example": 2
          },
          "solved": {
            "type": "boolean",
            "description": "Whether the inquiry handled in this Conversation has been resolved.",
            "example": false
          },
          "sessionId": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WebhookEntityReference"
              }
            ],
            "description": "Dialog associated with this Conversation.",
            "example": {
              "id": "mz43k5my686kjsfkfpzqkup6",
              "viewKey": "butlerSession"
            }
          },
          "lookup_3g71fgh5f5": {
            "type": "string",
            "description": "Associated classification or contact name recorded for the Conversation.",
            "example": "Zhang San"
          },
          "dataId": {
            "type": "string",
            "description": "Internal data identifier of the Conversation record.",
            "example": "uu5cha880vvk8tbw6e4hmv0i"
          },
          "userAccountId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier of the user account associated with the Conversation.",
            "example": "2ce63138-344c-40fe-976b-8f19d3d3d2fa"
          },
          "extendMap": {
            "type": "object",
            "description": "Custom fields associated with the Conversation.",
            "additionalProperties": true,
            "example": {}
          },
          "createdTime": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in milliseconds, when the Conversation was created.",
            "example": 1765465932005
          },
          "lookup_h70b811f83": {
            "type": "integer",
            "description": "Channel classification code associated with the Conversation.",
            "example": 102
          },
          "id": {
            "type": "string",
            "description": "Globally unique identifier of the Conversation record.",
            "example": "1448693862208901600"
          },
          "visitorId": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WebhookEntityReference"
              }
            ],
            "description": "Contact associated with this Conversation.",
            "example": {
              "id": "ailfxvj0qyhbyy5vryljrz4k",
              "viewKey": "butlerVisitor"
            }
          }
        }
      },
      "ConversationCreatedWebhookEvent": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "businessType",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for this webhook delivery.",
            "example": "f91692b3-f35c-4f3d-b398-e6f34491d3ce"
          },
          "businessType": {
            "type": "integer",
            "description": "Business type code. The value is 15000 for Conversation Created.",
            "const": 15000,
            "example": 15000
          },
          "data": {
            "$ref": "#/components/schemas/ConversationWebhookData"
          }
        },
        "example": {
          "requestId": "f91692b3-f35c-4f3d-b398-e6f34491d3ce",
          "businessType": 15000,
          "data": {
            "summary": "The contact asked about the Xiaomi 15 experience and purchasing options. The AI gathered the contact’s priorities, escalated the Conversation to a human agent, and confirmed the contact details for follow-up.",
            "convStatus": 3,
            "updatedTime": 1765466070910,
            "completedTime": 1765466070908,
            "replyStrategy": 2,
            "solved": false,
            "sessionId": {
              "id": "mz43k5my686kjsfkfpzqkup6",
              "viewKey": "butlerSession"
            },
            "lookup_3g71fgh5f5": "Zhang San",
            "dataId": "uu5cha880vvk8tbw6e4hmv0i",
            "userAccountId": "2ce63138-344c-40fe-976b-8f19d3d3d2fa",
            "extendMap": {},
            "createdTime": 1765465932005,
            "lookup_h70b811f83": 102,
            "id": "1448693862208901600",
            "visitorId": {
              "id": "ailfxvj0qyhbyy5vryljrz4k",
              "viewKey": "butlerVisitor"
            }
          }
        }
      },
      "ConversationUpdatedWebhookEvent": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "businessType",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for this webhook delivery.",
            "example": "f91692b3-f35c-4f3d-b398-e6f34491d3ce"
          },
          "businessType": {
            "type": "integer",
            "description": "Business type code. The value is 15001 for Conversation Updated.",
            "const": 15001,
            "example": 15001
          },
          "data": {
            "$ref": "#/components/schemas/ConversationWebhookData"
          }
        },
        "example": {
          "requestId": "f91692b3-f35c-4f3d-b398-e6f34491d3ce",
          "businessType": 15001,
          "data": {
            "summary": "The contact asked about the Xiaomi 15 experience and purchasing options. The AI gathered the contact’s priorities, escalated the Conversation to a human agent, and confirmed the contact details for follow-up.",
            "convStatus": 3,
            "updatedTime": 1765466070910,
            "completedTime": 1765466070908,
            "replyStrategy": 2,
            "solved": false,
            "sessionId": {
              "id": "mz43k5my686kjsfkfpzqkup6",
              "viewKey": "butlerSession"
            },
            "lookup_3g71fgh5f5": "Zhang San",
            "dataId": "uu5cha880vvk8tbw6e4hmv0i",
            "userAccountId": "2ce63138-344c-40fe-976b-8f19d3d3d2fa",
            "extendMap": {},
            "createdTime": 1765465932005,
            "lookup_h70b811f83": 102,
            "id": "1448693862208901600",
            "visitorId": {
              "id": "ailfxvj0qyhbyy5vryljrz4k",
              "viewKey": "butlerVisitor"
            }
          }
        }
      },
      "ConversationRoutedToHumanWebhookEvent": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "businessType",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for this webhook delivery.",
            "example": "f91692b3-f35c-4f3d-b398-e6f34491d3ce"
          },
          "businessType": {
            "type": "integer",
            "description": "Business type code. The value is 15002 for Conversation Routed to Human.",
            "const": 15002,
            "example": 15002
          },
          "data": {
            "$ref": "#/components/schemas/ConversationWebhookData"
          }
        },
        "example": {
          "requestId": "f91692b3-f35c-4f3d-b398-e6f34491d3ce",
          "businessType": 15002,
          "data": {
            "summary": "The contact asked about the Xiaomi 15 experience and purchasing options. The AI gathered the contact’s priorities, escalated the Conversation to a human agent, and confirmed the contact details for follow-up.",
            "convStatus": 3,
            "updatedTime": 1765466070910,
            "completedTime": 1765466070908,
            "replyStrategy": 2,
            "solved": false,
            "sessionId": {
              "id": "mz43k5my686kjsfkfpzqkup6",
              "viewKey": "butlerSession"
            },
            "lookup_3g71fgh5f5": "Zhang San",
            "dataId": "uu5cha880vvk8tbw6e4hmv0i",
            "userAccountId": "2ce63138-344c-40fe-976b-8f19d3d3d2fa",
            "extendMap": {},
            "createdTime": 1765465932005,
            "lookup_h70b811f83": 102,
            "id": "1448693862208901600",
            "visitorId": {
              "id": "ailfxvj0qyhbyy5vryljrz4k",
              "viewKey": "butlerVisitor"
            }
          }
        }
      },
      "ConversationClosedWebhookEvent": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "businessType",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for this webhook delivery.",
            "example": "f91692b3-f35c-4f3d-b398-e6f34491d3ce"
          },
          "businessType": {
            "type": "integer",
            "description": "Business type code. The value is 15003 for Conversation Closed.",
            "const": 15003,
            "example": 15003
          },
          "data": {
            "$ref": "#/components/schemas/ConversationWebhookData"
          }
        },
        "example": {
          "requestId": "f91692b3-f35c-4f3d-b398-e6f34491d3ce",
          "businessType": 15003,
          "data": {
            "summary": "The contact asked about the Xiaomi 15 experience and purchasing options. The AI gathered the contact’s priorities, escalated the Conversation to a human agent, and confirmed the contact details for follow-up.",
            "convStatus": 3,
            "updatedTime": 1765466070910,
            "completedTime": 1765466070908,
            "replyStrategy": 2,
            "solved": false,
            "sessionId": {
              "id": "mz43k5my686kjsfkfpzqkup6",
              "viewKey": "butlerSession"
            },
            "lookup_3g71fgh5f5": "Zhang San",
            "dataId": "uu5cha880vvk8tbw6e4hmv0i",
            "userAccountId": "2ce63138-344c-40fe-976b-8f19d3d3d2fa",
            "extendMap": {},
            "createdTime": 1765465932005,
            "lookup_h70b811f83": 102,
            "id": "1448693862208901600",
            "visitorId": {
              "id": "ailfxvj0qyhbyy5vryljrz4k",
              "viewKey": "butlerVisitor"
            }
          }
        }
      },
      "ContactRejoinedConversationWebhookEvent": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "businessType",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for this webhook delivery.",
            "example": "f91692b3-f35c-4f3d-b398-e6f34491d3ce"
          },
          "businessType": {
            "type": "integer",
            "description": "Business type code. The value is 15006 for Contact Rejoined Conversation.",
            "const": 15006,
            "example": 15006
          },
          "data": {
            "$ref": "#/components/schemas/ConversationWebhookData"
          }
        },
        "example": {
          "requestId": "f91692b3-f35c-4f3d-b398-e6f34491d3ce",
          "businessType": 15006,
          "data": {
            "summary": "The contact asked about the Xiaomi 15 experience and purchasing options. The AI gathered the contact’s priorities, escalated the Conversation to a human agent, and confirmed the contact details for follow-up.",
            "convStatus": 3,
            "updatedTime": 1765466070910,
            "completedTime": 1765466070908,
            "replyStrategy": 2,
            "solved": false,
            "sessionId": {
              "id": "mz43k5my686kjsfkfpzqkup6",
              "viewKey": "butlerSession"
            },
            "lookup_3g71fgh5f5": "Zhang San",
            "dataId": "uu5cha880vvk8tbw6e4hmv0i",
            "userAccountId": "2ce63138-344c-40fe-976b-8f19d3d3d2fa",
            "extendMap": {},
            "createdTime": 1765465932005,
            "lookup_h70b811f83": 102,
            "id": "1448693862208901600",
            "visitorId": {
              "id": "ailfxvj0qyhbyy5vryljrz4k",
              "viewKey": "butlerVisitor"
            }
          }
        }
      },
      "ChatGroupChannelReference": {
        "type": "object",
        "description": "Channel associated with the chat group.",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier of the channel.",
            "example": "143555921712459776"
          },
          "value": {
            "type": "string",
            "description": "Stored channel reference value.",
            "example": "143555921712459776"
          },
          "entityKey": {
            "type": "string",
            "description": "Entity key of the referenced channel.",
            "example": "butlerChannel"
          },
          "viewKey": {
            "type": "string",
            "description": "View key of the referenced channel.",
            "example": "butlerChannel"
          }
        }
      },
      "ChatGroupWebhookData": {
        "type": "object",
        "description": "The chat group record included in the webhook event.",
        "required": [
          "id",
          "dataId",
          "name",
          "externalGroupId",
          "channelId",
          "createdTime",
          "updatedTime"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Globally unique identifier of the chat group.",
            "example": "144304948082573313"
          },
          "dataId": {
            "type": "string",
            "description": "Internal data identifier of the chat group record.",
            "example": "144304948082573313"
          },
          "name": {
            "type": "string",
            "description": "Display name of the chat group.",
            "example": "Product discussion group"
          },
          "avatar": {
            "type": "string",
            "format": "uri",
            "description": "URL of the chat group avatar.",
            "example": "https://example.com/chat-group/avatar.png"
          },
          "channelType": {
            "type": "string",
            "description": "Type of the connected channel that owns the chat group.",
            "example": "chatly"
          },
          "externalGroupId": {
            "type": "string",
            "description": "Chat group identifier assigned by the external channel.",
            "example": "R:10970772183721730"
          },
          "wecomChatId": {
            "type": "string",
            "description": "Native WeCom group-chat identifier, when the group belongs to WeCom.",
            "example": "wrxxxxxxxxxxxx"
          },
          "channelId": {
            "$ref": "#/components/schemas/ChatGroupChannelReference"
          },
          "lookup_2e4hdgd7hg": {
            "type": "integer",
            "description": "Internal channel or group classification code.",
            "example": 2
          },
          "extendMap": {
            "type": "object",
            "description": "Custom fields associated with the chat group.",
            "additionalProperties": true,
            "example": {}
          },
          "createdTime": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in milliseconds, when the chat group was created in 3Chat.",
            "example": 1784465973920
          },
          "updatedTime": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in milliseconds, when the chat group was last updated.",
            "example": 1785155638473
          }
        }
      },
      "EmailMessageDetails": {
        "type": "object",
        "description": "Email-specific message details. Present only for email messages.",
        "properties": {
          "from": {
            "type": "string",
            "format": "email",
            "description": "Sender email address."
          },
          "fromName": {
            "type": "string",
            "description": "Sender display name."
          },
          "to": {
            "type": "array",
            "description": "Recipient email addresses.",
            "items": {
              "type": "string",
              "format": "email"
            }
          },
          "cc": {
            "type": "array",
            "description": "CC recipient email addresses.",
            "items": {
              "type": "string",
              "format": "email"
            }
          },
          "bcc": {
            "type": "array",
            "description": "BCC recipient email addresses.",
            "items": {
              "type": "string",
              "format": "email"
            }
          },
          "subject": {
            "type": "string",
            "description": "Email subject."
          }
        }
      },
      "MessageAttachment": {
        "type": "object",
        "description": "File attached to the message.",
        "required": [
          "key",
          "name",
          "contentType",
          "url",
          "size"
        ],
        "properties": {
          "key": {
            "type": "string",
            "description": "Unique attachment key."
          },
          "name": {
            "type": "string",
            "description": "Attachment file name."
          },
          "contentType": {
            "type": "string",
            "description": "MIME type of the attachment.",
            "example": "image/png"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "URL from which the attachment can be accessed."
          },
          "size": {
            "type": "integer",
            "format": "int64",
            "description": "Attachment size in bytes."
          }
        }
      },
      "KnowledgeRetrievalResult": {
        "type": "object",
        "description": "Knowledge-base chunk retrieved while the AI agent processed the message.",
        "properties": {
          "chunk_id": {
            "type": "string",
            "description": "Identifier of the retrieved chunk."
          },
          "content": {
            "type": "string",
            "description": "Content of the retrieved chunk."
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in seconds, when the chunk was created."
          },
          "document_id": {
            "type": "string",
            "description": "Identifier of the source document."
          },
          "document_name": {
            "type": "string",
            "description": "Name of the source document."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether the knowledge chunk is enabled."
          },
          "lang": {
            "type": "string",
            "description": "Language code of the chunk."
          },
          "score": {
            "type": "number",
            "format": "double",
            "description": "Retrieval relevance score."
          },
          "source": {
            "type": "string",
            "description": "Type of the knowledge source."
          }
        }
      },
      "AgentExecutionLog": {
        "type": "object",
        "description": "A step recorded while the AI agent processed the message.",
        "required": [
          "type",
          "timestamp"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Log category.",
            "enum": [
              "language",
              "recall",
              "task",
              "knowledge",
              "tool",
              "internalTool",
              "systemTask"
            ]
          },
          "timestamp": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in milliseconds, when this step occurred."
          },
          "message": {
            "type": "string",
            "description": "Result or detail recorded for this processing step."
          },
          "status": {
            "type": "string",
            "description": "Step status, such as `certain`, `uncertain`, `success`, or `failed`."
          },
          "name": {
            "type": "string",
            "description": "Selected task, tool, or system-task name."
          },
          "costTime": {
            "type": "integer",
            "format": "int64",
            "description": "Tool execution time in milliseconds."
          },
          "kb": {
            "type": "array",
            "description": "Knowledge-base results retrieved for the message.",
            "items": {
              "$ref": "#/components/schemas/KnowledgeRetrievalResult"
            }
          },
          "entity": {
            "type": "object",
            "description": "Entity data used by an internal tool.",
            "properties": {
              "name": {
                "type": "string",
                "description": "Entity type."
              },
              "values": {
                "type": "array",
                "description": "Values extracted for the entity.",
                "items": {}
              }
            }
          }
        }
      },
      "MessageWebhookData": {
        "type": "object",
        "description": "The message created in 3Chat.",
        "required": [
          "id",
          "dataId",
          "senderId",
          "workSpaceId",
          "senderType",
          "sendTime",
          "content",
          "channelId",
          "conversationId",
          "sessionId",
          "createdTime",
          "updatedTime"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Globally unique identifier of the message.",
            "example": "51901704862228480"
          },
          "dataId": {
            "type": "string",
            "description": "Internal data identifier of the message record.",
            "example": "7g0rzhgjp0a3xqpdd"
          },
          "senderId": {
            "type": "string",
            "description": "Sender identifier. Its meaning depends on `senderType`: Contact ID for `1`, platform user ID for `2`, and AI agent ID for `3`.",
            "example": "51901681609007100"
          },
          "workSpaceId": {
            "type": "string",
            "format": "uuid",
            "description": "Identifier of the Workspace that owns the message.",
            "example": "a4872870-3cde-47f2-830f-a5f07801790b"
          },
          "senderType": {
            "type": "integer",
            "description": "Sender type: `-1` unknown, `0` system, `1` Contact, `2` human agent, or `3` AI agent.",
            "enum": [
              -1,
              0,
              1,
              2,
              3
            ],
            "example": 1
          },
          "sendTime": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in seconds, when the message was sent.",
            "example": 1770489117
          },
          "content": {
            "type": "string",
            "description": "Message content.",
            "example": "Tell me about your services."
          },
          "channelId": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WebhookEntityReference"
              }
            ],
            "description": "Channel through which the message was sent."
          },
          "conversationId": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WebhookEntityReference"
              }
            ],
            "description": "Conversation that contains the message."
          },
          "sessionId": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WebhookEntityReference"
              }
            ],
            "description": "Dialog associated with the message."
          },
          "isEffectiveReply": {
            "type": "boolean",
            "description": "Whether the message counts as an effective reply.",
            "example": true
          },
          "email": {
            "$ref": "#/components/schemas/EmailMessageDetails"
          },
          "attachments": {
            "type": "array",
            "description": "Files attached to the message.",
            "items": {
              "$ref": "#/components/schemas/MessageAttachment"
            }
          },
          "agentLogs": {
            "type": "array",
            "description": "Execution log produced while the AI agent processed the message.",
            "items": {
              "$ref": "#/components/schemas/AgentExecutionLog"
            }
          },
          "createdTime": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in milliseconds, when the message record was created.",
            "example": 1770489117249
          },
          "updatedTime": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in milliseconds, when the message record was last updated.",
            "example": 1747115523185
          },
          "thirdId": {
            "type": "string",
            "description": "Message identifier assigned by the external channel.",
            "example": "external_message_id"
          },
          "replyMessageId": {
            "type": "string",
            "description": "Identifier of the message to which this message replies.",
            "example": "reply_message_id"
          },
          "processedBy": {
            "type": "integer",
            "description": "Processing owner: `0` unmarked, `1` human agent, or `2` AI agent.",
            "enum": [
              0,
              1,
              2
            ],
            "example": 2
          }
        }
      },
      "ChatGroupCreatedWebhookEvent": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "businessType",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for this webhook delivery.",
            "example": "ec7ca9e0-9800-43e5-b433-68f979e7ef5c"
          },
          "businessType": {
            "type": "integer",
            "description": "Business type code. The value is 15036 for Chat Group Created.",
            "const": 15036,
            "example": 15036
          },
          "data": {
            "$ref": "#/components/schemas/ChatGroupWebhookData"
          }
        },
        "example": {
          "requestId": "ec7ca9e0-9800-43e5-b433-68f979e7ef5c",
          "businessType": 15036,
          "data": {
            "updatedTime": 1785155638473,
            "lookup_2e4hdgd7hg": 2,
            "dataId": "144304948082573313",
            "extendMap": {},
            "name": "Product discussion group",
            "createdTime": 1784465973920,
            "externalGroupId": "R:10970772183721730",
            "id": "144304948082573313",
            "avatar": "https://example.com/chat-group/avatar.png",
            "channelId": {
              "id": "143555921712459776",
              "value": "143555921712459776",
              "entityKey": "butlerChannel",
              "viewKey": "butlerChannel"
            }
          }
        }
      },
      "ChatGroupUpdatedWebhookEvent": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "businessType",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for this webhook delivery.",
            "example": "ec7ca9e0-9800-43e5-b433-68f979e7ef5c"
          },
          "businessType": {
            "type": "integer",
            "description": "Business type code. The value is 15037 for Chat Group Updated.",
            "const": 15037,
            "example": 15037
          },
          "data": {
            "$ref": "#/components/schemas/ChatGroupWebhookData"
          }
        },
        "example": {
          "requestId": "ec7ca9e0-9800-43e5-b433-68f979e7ef5c",
          "businessType": 15037,
          "data": {
            "updatedTime": 1785155638473,
            "lookup_2e4hdgd7hg": 2,
            "dataId": "144304948082573313",
            "extendMap": {
              "customerTier": "standard"
            },
            "name": "Product discussion group",
            "createdTime": 1784465973920,
            "externalGroupId": "R:10970772183721730",
            "id": "144304948082573313",
            "avatar": "https://example.com/chat-group/avatar.png",
            "channelId": {
              "id": "143555921712459776",
              "value": "143555921712459776",
              "entityKey": "butlerChannel",
              "viewKey": "butlerChannel"
            }
          }
        }
      },
      "MessageCreatedWebhookEvent": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "businessType",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for this webhook delivery.",
            "example": "ec7ca9e0-9800-43e5-b433-68f979e7ef5c"
          },
          "businessType": {
            "type": "integer",
            "description": "Business type code. The value is 15016 for Message Created.",
            "const": 15016,
            "example": 15016
          },
          "data": {
            "$ref": "#/components/schemas/MessageWebhookData"
          }
        },
        "example": {
          "requestId": "ec7ca9e0-9800-43e5-b433-68f979e7ef5c",
          "businessType": 15016,
          "data": {
            "id": "51901704862228480",
            "dataId": "7g0rzhgjp0a3xqpdd",
            "senderId": "51901681609007100",
            "workSpaceId": "a4872870-3cde-47f2-830f-a5f07801790b",
            "senderType": 1,
            "sendTime": 1770489117,
            "content": "Tell me about your services.",
            "channelId": {
              "id": "d56sxkazsuqdqz0d5u",
              "viewKey": "butlerChannel"
            },
            "conversationId": {
              "id": "aqxqpddc36lyaeysxhhuekih",
              "viewKey": "butlerConversation"
            },
            "sessionId": {
              "id": "kiaa9exjdwdcnzrzqgjp0a32",
              "viewKey": "butlerSession"
            },
            "isEffectiveReply": true,
            "email": {
              "from": "sender@example.com",
              "fromName": "Example Contact",
              "to": [
                "support@example.com"
              ],
              "cc": [],
              "bcc": [],
              "subject": "Product inquiry"
            },
            "attachments": [
              {
                "key": "attachment_001",
                "name": "product.png",
                "contentType": "image/png",
                "url": "https://example.com/files/product.png",
                "size": 3132
              }
            ],
            "agentLogs": [
              {
                "type": "language",
                "message": "English",
                "status": "certain",
                "timestamp": 1762915391425
              }
            ],
            "createdTime": 1770489117249,
            "updatedTime": 1770489117249,
            "thirdId": "external_message_id",
            "replyMessageId": "reply_message_id",
            "processedBy": 2
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Access Token",
        "description": "Access Token returned by the Create Access Token or Refresh Access Token endpoint."
      }
    }
  },
  "webhooks": {
    "BUTLER_DIALOG_CREATED": {
      "post": {
        "summary": "Dialog Created",
        "operationId": "onButlerDialogCreated",
        "tags": [
          "Dialog/Events"
        ],
        "description": "Sent when a new dialog is created in 3Chat. 3Chat delivers this outbound event to the HTTPS webhook URL configured by the developer in 3Chat Open Platform. Subscribe to `BUTLER_DIALOG_CREATED` to receive it.",
        "security": [],
        "parameters": [
          {
            "name": "TENANT_ID",
            "in": "header",
            "required": true,
            "description": "ID of the tenant associated with this event.",
            "schema": {
              "type": "string"
            },
            "example": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
          },
          {
            "name": "STAFF_ID",
            "in": "header",
            "required": false,
            "description": "ID of the staff member associated with the event, when applicable.",
            "schema": {
              "type": "string"
            },
            "example": "123123"
          },
          {
            "name": "x-nct-time",
            "in": "header",
            "required": true,
            "description": "Timestamp when the event was generated.",
            "schema": {
              "type": "string"
            },
            "example": "1750351569887"
          },
          {
            "name": "business-type",
            "in": "header",
            "required": true,
            "description": "Business type code for the Dialog Created event.",
            "schema": {
              "type": "string"
            },
            "example": "15013"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "JSON payload delivered to the configured webhook URL.",
          "content": {
            "application/json": {
              "schema": {
                "title": "Dialog Created event payload",
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "requestId",
                  "businessType",
                  "data"
                ],
                "properties": {
                  "requestId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Unique identifier for this webhook delivery.",
                    "example": "03703d30-50f2-4103-bdb6-8aa331f36cc5"
                  },
                  "businessType": {
                    "type": "integer",
                    "description": "Business type code. The value is 15013 for Dialog Created.",
                    "const": 15013,
                    "example": 15013
                  },
                  "data": {
                    "type": "object",
                    "description": "The dialog that was created.",
                    "additionalProperties": false,
                    "required": [
                      "id",
                      "workSpaceId",
                      "type",
                      "channelId",
                      "visitorId",
                      "lastMessageId",
                      "createdTime",
                      "updatedTime"
                    ],
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Unique identifier of the dialog.",
                        "example": "sess_p2p_001"
                      },
                      "workSpaceId": {
                        "type": "string",
                        "description": "Identifier of the 3Chat Workspace that owns the dialog.",
                        "example": "ws_001"
                      },
                      "type": {
                        "type": "string",
                        "description": "Dialog type.",
                        "example": "p2p"
                      },
                      "channelId": {
                        "type": "object",
                        "description": "Channel associated with the dialog.",
                        "additionalProperties": false,
                        "required": [
                          "id"
                        ],
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Unique identifier of the channel.",
                            "example": "ch_livechat_01"
                          }
                        }
                      },
                      "visitorId": {
                        "type": "object",
                        "description": "Visitor associated with the dialog.",
                        "additionalProperties": false,
                        "required": [
                          "id"
                        ],
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Unique identifier of the visitor.",
                            "example": "visitor_123"
                          }
                        }
                      },
                      "lastMessageId": {
                        "type": "object",
                        "description": "Latest message in the dialog when the event was generated.",
                        "additionalProperties": false,
                        "required": [
                          "id"
                        ],
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Unique identifier of the latest message.",
                            "example": "msg_202"
                          }
                        }
                      },
                      "createdTime": {
                        "type": "integer",
                        "format": "int64",
                        "description": "Unix timestamp when the dialog was created.",
                        "example": 1690000000
                      },
                      "updatedTime": {
                        "type": "integer",
                        "format": "int64",
                        "description": "Unix timestamp when the dialog was last updated.",
                        "example": 1690003600
                      }
                    }
                  }
                }
              },
              "examples": {
                "dialogCreated": {
                  "summary": "Dialog Created payload",
                  "value": {
                    "requestId": "03703d30-50f2-4103-bdb6-8aa331f36cc5",
                    "businessType": 15013,
                    "data": {
                      "id": "sess_p2p_001",
                      "workSpaceId": "ws_001",
                      "type": "p2p",
                      "channelId": {
                        "id": "ch_livechat_01"
                      },
                      "visitorId": {
                        "id": "visitor_123"
                      },
                      "lastMessageId": {
                        "id": "msg_202"
                      },
                      "createdTime": 1690000000,
                      "updatedTime": 1690003600
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook event received successfully."
          },
          "204": {
            "description": "Webhook event received successfully; no response body."
          }
        }
      }
    },
    "BUTLER_VISITOR_CREATED": {
      "post": {
        "summary": "Contact Created",
        "operationId": "onButlerVisitorCreated",
        "tags": [
          "Visitor/Events"
        ],
        "description": "Sent when 3Chat creates a new contact. A contact can be created in any of these situations:\n\n- A developer calls the Agent API operation **Send Message to Agent** for a person who does not yet have a contact record.\n- A developer calls the Channel API operation **Send Message** for a person who does not yet have a contact record.\n- After a channel is connected to 3Chat, a previously unknown person sends their first inbound message through that channel.\n\n3Chat delivers this outbound event to the HTTPS webhook URL configured by the developer in 3Chat Open Platform. Subscribe to `BUTLER_VISITOR_CREATED` to receive it.",
        "security": [],
        "parameters": [
          {
            "name": "TENANT_ID",
            "in": "header",
            "required": true,
            "description": "ID of the tenant associated with this event.",
            "schema": {
              "type": "string"
            },
            "example": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
          },
          {
            "name": "STAFF_ID",
            "in": "header",
            "required": false,
            "description": "ID of the staff member associated with the event, when applicable.",
            "schema": {
              "type": "string"
            },
            "example": "123123"
          },
          {
            "name": "x-nct-time",
            "in": "header",
            "required": true,
            "description": "Timestamp when the event was generated.",
            "schema": {
              "type": "string"
            },
            "example": "1750351569887"
          },
          {
            "name": "business-type",
            "in": "header",
            "required": true,
            "description": "Business type code for the Contact Created event.",
            "schema": {
              "type": "string",
              "const": "15009"
            },
            "example": "15009"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "JSON payload delivered to the configured webhook URL.",
          "content": {
            "application/json": {
              "schema": {
                "title": "Contact Created event payload",
                "$ref": "#/components/schemas/ContactCreatedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook event received successfully."
          },
          "204": {
            "description": "Webhook event received successfully; no response body."
          }
        }
      }
    },
    "BUTLER_VISITOR_UPDATED": {
      "post": {
        "summary": "Contact Updated",
        "operationId": "onButlerVisitorUpdated",
        "tags": [
          "Visitor/Events"
        ],
        "description": "Sent when a contact's profile or associated contact data is updated in 3Chat. 3Chat delivers this outbound event to the HTTPS webhook URL configured by the developer in 3Chat Open Platform. Subscribe to `BUTLER_VISITOR_UPDATED` to receive it.",
        "security": [],
        "parameters": [
          {
            "name": "TENANT_ID",
            "in": "header",
            "required": true,
            "description": "ID of the tenant associated with this event.",
            "schema": {
              "type": "string"
            },
            "example": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
          },
          {
            "name": "STAFF_ID",
            "in": "header",
            "required": false,
            "description": "ID of the staff member associated with the event, when applicable.",
            "schema": {
              "type": "string"
            },
            "example": "123123"
          },
          {
            "name": "x-nct-time",
            "in": "header",
            "required": true,
            "description": "Timestamp when the event was generated.",
            "schema": {
              "type": "string"
            },
            "example": "1750351569887"
          },
          {
            "name": "business-type",
            "in": "header",
            "required": true,
            "description": "Business type code for the Contact Updated event.",
            "schema": {
              "type": "string",
              "const": "15010"
            },
            "example": "15010"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "JSON payload delivered to the configured webhook URL.",
          "content": {
            "application/json": {
              "schema": {
                "title": "Contact Updated event payload",
                "$ref": "#/components/schemas/ContactUpdatedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook event received successfully."
          },
          "204": {
            "description": "Webhook event received successfully; no response body."
          }
        }
      }
    },
    "BUTLER_CONVERSATION_CREATED": {
      "post": {
        "summary": "Conversation Created",
        "operationId": "onButlerConversationCreated",
        "tags": [
          "Conversation/Events"
        ],
        "description": "Triggered when a Conversation is created in 3Chat. 3Chat delivers this outbound event to the HTTPS webhook URL configured by the developer.\n\n## Prerequisites\n\nCreate a Webhook application in **Open Platform → Webhook**, configure its receiving URL, and subscribe to `BUTLER_CONVERSATION_CREATED`.\n\n## When is this event triggered?\n\n### What is a Conversation?\n\nA Conversation is a continuous, time-bounded exchange of messages between a channel-bound account, such as Live Chat, a Facebook Page, or an Instagram account, and a Contact. It contains the messages exchanged during that active communication window.\n\n### Relationship between Dialog and Conversation\n\nA Dialog represents the long-term relationship between a channel account and a Contact. A Conversation belongs to a Dialog and manages messages within a shorter, activity-based window.\n\n### Creation timing\n\nA channel must be connected first. When either side sends the first message, 3Chat creates a Dialog if one does not already exist and creates the first Conversation at the same time.\n\n### Lifecycle\n\nA Conversation closes automatically after a configured period of inactivity. After it closes, a new message from either side creates a new Conversation under the existing Dialog.",
        "security": [],
        "parameters": [
          {
            "name": "TENANT_ID",
            "in": "header",
            "required": true,
            "description": "ID of the tenant associated with this event.",
            "schema": {
              "type": "string"
            },
            "example": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
          },
          {
            "name": "STAFF_ID",
            "in": "header",
            "required": false,
            "description": "ID of the staff member associated with the event, when applicable.",
            "schema": {
              "type": "string"
            },
            "example": "123123"
          },
          {
            "name": "x-nct-time",
            "in": "header",
            "required": true,
            "description": "Timestamp when the event was generated.",
            "schema": {
              "type": "string"
            },
            "example": "1750351569887"
          },
          {
            "name": "business-type",
            "in": "header",
            "required": true,
            "description": "Business type code for the Conversation Created event.",
            "schema": {
              "type": "string",
              "const": "15000"
            },
            "example": "15000"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "JSON payload delivered to the configured webhook URL.",
          "content": {
            "application/json": {
              "schema": {
                "title": "Conversation Created event payload",
                "$ref": "#/components/schemas/ConversationCreatedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook event received successfully."
          },
          "204": {
            "description": "Webhook event received successfully; no response body."
          }
        }
      }
    },
    "BUTLER_CONVERSATION_UPDATE": {
      "post": {
        "summary": "Conversation Updated",
        "operationId": "onButlerConversationUpdated",
        "tags": [
          "Conversation/Events"
        ],
        "description": "Triggered when key attributes of a Conversation change in 3Chat. 3Chat delivers this outbound event to the HTTPS webhook URL configured by the developer.\n\n## Prerequisites\n\nCreate a Webhook application in **Open Platform → Webhook**, configure its receiving URL, and subscribe to `BUTLER_CONVERSATION_UPDATE`.\n\n## Understanding the Conversation entity\n\nA Conversation is a time-bounded communication window between a channel-bound account and a Contact. It belongs to a Dialog, which represents the long-term relationship between them. A Conversation contains messages exchanged during one active period, closes after inactivity, and is replaced by a new Conversation when either side sends another message.\n\n## When is this event triggered?\n\nThe event is emitted when important Conversation attributes change, including these situations:\n\n1. **AI Skills update Conversation fields.** AI Skills classify, tag, enrich, or otherwise update custom fields associated with the Conversation.\n2. **The Conversation is escalated to a human agent.** The Contact requests human assistance, a human agent takes over in the Inbox, or an external system calls the **Escalate to Human** OpenAPI operation.\n3. **The Conversation closes automatically.** Both sides remain inactive for the configured period, and the latest status and timestamps are recorded.\n4. **Control is returned to the AI agent.** After a human agent resolves the issue, an Inbox user manually restores AI handling and the reply strategy changes.",
        "security": [],
        "parameters": [
          {
            "name": "TENANT_ID",
            "in": "header",
            "required": true,
            "description": "ID of the tenant associated with this event.",
            "schema": {
              "type": "string"
            },
            "example": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
          },
          {
            "name": "STAFF_ID",
            "in": "header",
            "required": false,
            "description": "ID of the staff member associated with the event, when applicable.",
            "schema": {
              "type": "string"
            },
            "example": "123123"
          },
          {
            "name": "x-nct-time",
            "in": "header",
            "required": true,
            "description": "Timestamp when the event was generated.",
            "schema": {
              "type": "string"
            },
            "example": "1750351569887"
          },
          {
            "name": "business-type",
            "in": "header",
            "required": true,
            "description": "Business type code for the Conversation Updated event.",
            "schema": {
              "type": "string",
              "const": "15001"
            },
            "example": "15001"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "JSON payload delivered to the configured webhook URL.",
          "content": {
            "application/json": {
              "schema": {
                "title": "Conversation Updated event payload",
                "$ref": "#/components/schemas/ConversationUpdatedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook event received successfully."
          },
          "204": {
            "description": "Webhook event received successfully; no response body."
          }
        }
      }
    },
    "BUTLER_CONVERSATION_RETURN_JOINED": {
      "post": {
        "summary": "Contact Rejoined Conversation",
        "operationId": "onButlerConversationReturnJoined",
        "tags": [
          "Conversation/Events"
        ],
        "description": "Triggered when an existing Contact starts another Conversation under the same Dialog. This event identifies subsequent inquiries rather than the Contact's first interaction.\n\n## Prerequisites\n\nCreate a Webhook application in **Open Platform → Webhook**, configure its receiving URL, and subscribe to `BUTLER_CONVERSATION_RETURN_JOINED`.\n\nReview **Conversation Created** or **Conversation Updated** first if you are not familiar with the Conversation lifecycle.\n\n## What does “Contact Rejoined Conversation” mean?\n\nThis event is emitted for the second and every later Conversation under an existing Dialog (`N ≥ 2`). It is not emitted for the first Conversation.\n\nThe typical sequence is:\n\n1. At least one previous Conversation exists and has closed because of inactivity or completion.\n2. The same Contact sends a new message.\n3. 3Chat creates a new Conversation under the existing Dialog.\n4. This event is delivered to indicate that the Contact has started another active communication window.\n\nTo detect a Contact's first inquiry, subscribe to **Contact Created** or **Dialog Created** instead.",
        "security": [],
        "parameters": [
          {
            "name": "TENANT_ID",
            "in": "header",
            "required": true,
            "description": "ID of the tenant associated with this event.",
            "schema": {
              "type": "string"
            },
            "example": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
          },
          {
            "name": "STAFF_ID",
            "in": "header",
            "required": false,
            "description": "ID of the staff member associated with the event, when applicable.",
            "schema": {
              "type": "string"
            },
            "example": "123123"
          },
          {
            "name": "x-nct-time",
            "in": "header",
            "required": true,
            "description": "Timestamp when the event was generated.",
            "schema": {
              "type": "string"
            },
            "example": "1750351569887"
          },
          {
            "name": "business-type",
            "in": "header",
            "required": true,
            "description": "Business type code for the Contact Rejoined Conversation event.",
            "schema": {
              "type": "string",
              "const": "15006"
            },
            "example": "15006"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "JSON payload delivered to the configured webhook URL.",
          "content": {
            "application/json": {
              "schema": {
                "title": "Contact Rejoined Conversation event payload",
                "$ref": "#/components/schemas/ContactRejoinedConversationWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook event received successfully."
          },
          "204": {
            "description": "Webhook event received successfully; no response body."
          }
        }
      }
    },
    "BUTLER_CONVERSATION_ROUTED_TO_PERSON": {
      "post": {
        "summary": "Conversation Routed to Human",
        "operationId": "onButlerConversationRoutedToPerson",
        "tags": [
          "Conversation/Events"
        ],
        "description": "Triggered when a Conversation moves from AI handling to human handling in 3Chat. 3Chat delivers this outbound event to the HTTPS webhook URL configured by the developer.\n\n## Prerequisites\n\nCreate a Webhook application in **Open Platform → Webhook**, configure its receiving URL, and subscribe to `BUTLER_CONVERSATION_ROUTED_TO_PERSON`.\n\nReview **Conversation Created** or **Conversation Updated** first if you are not familiar with the Conversation lifecycle.\n\n## When is this event triggered?\n\nCommon escalation scenarios include:\n\n1. **The Contact requests human assistance.** The AI recognizes an escalation request, based on the intent rules configured in **Guidance**, and routes the Conversation to a human agent.\n2. **A third-party system escalates the Conversation.** The system calls the **Escalate to Human** OpenAPI operation.\n\nAfter escalation, the AI stops replying, the Conversation enters human-handled mode, and this event notifies subscribed systems of the transition.",
        "security": [],
        "parameters": [
          {
            "name": "TENANT_ID",
            "in": "header",
            "required": true,
            "description": "ID of the tenant associated with this event.",
            "schema": {
              "type": "string"
            },
            "example": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
          },
          {
            "name": "STAFF_ID",
            "in": "header",
            "required": false,
            "description": "ID of the staff member associated with the event, when applicable.",
            "schema": {
              "type": "string"
            },
            "example": "123123"
          },
          {
            "name": "x-nct-time",
            "in": "header",
            "required": true,
            "description": "Timestamp when the event was generated.",
            "schema": {
              "type": "string"
            },
            "example": "1750351569887"
          },
          {
            "name": "business-type",
            "in": "header",
            "required": true,
            "description": "Business type code for the Conversation Routed to Human event.",
            "schema": {
              "type": "string",
              "const": "15002"
            },
            "example": "15002"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "JSON payload delivered to the configured webhook URL.",
          "content": {
            "application/json": {
              "schema": {
                "title": "Conversation Routed to Human event payload",
                "$ref": "#/components/schemas/ConversationRoutedToHumanWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook event received successfully."
          },
          "204": {
            "description": "Webhook event received successfully; no response body."
          }
        }
      }
    },
    "BUTLER_CONVERSATION_CLOSED": {
      "post": {
        "summary": "Conversation Closed",
        "operationId": "onButlerConversationClosed",
        "tags": [
          "Conversation/Events"
        ],
        "description": "Triggered when a Conversation closes in 3Chat. This event identifies the end of an active communication window and its transition to the closed state.\n\n## Prerequisites\n\nCreate a Webhook application in **Open Platform → Webhook**, configure its receiving URL, and subscribe to `BUTLER_CONVERSATION_CLOSED`.\n\nReview **Conversation Created** or **Conversation Updated** first if you are not familiar with the Conversation lifecycle.\n\n## When is a Conversation closed?\n\n1. **Automatic closure after inactivity.** When neither the Contact nor the AI or human agent sends a message during the configured idle period, 3Chat closes the Conversation. If **Smart Agent Re-Online** is enabled, the AI agent becomes available for the next incoming Conversation. Configure this behavior under **3Chat Agent → General Settings**, using **Smart Agent Re-Online** and **Re-online wait time**.\n2. **Manual closure by a human agent.** A human agent can close the active Conversation in the Inbox to finish the current communication window and return control to the AI agent.",
        "security": [],
        "parameters": [
          {
            "name": "TENANT_ID",
            "in": "header",
            "required": true,
            "description": "ID of the tenant associated with this event.",
            "schema": {
              "type": "string"
            },
            "example": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
          },
          {
            "name": "STAFF_ID",
            "in": "header",
            "required": false,
            "description": "ID of the staff member associated with the event, when applicable.",
            "schema": {
              "type": "string"
            },
            "example": "123123"
          },
          {
            "name": "x-nct-time",
            "in": "header",
            "required": true,
            "description": "Timestamp when the event was generated.",
            "schema": {
              "type": "string"
            },
            "example": "1750351569887"
          },
          {
            "name": "business-type",
            "in": "header",
            "required": true,
            "description": "Business type code for the Conversation Closed event.",
            "schema": {
              "type": "string",
              "const": "15003"
            },
            "example": "15003"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "JSON payload delivered to the configured webhook URL.",
          "content": {
            "application/json": {
              "schema": {
                "title": "Conversation Closed event payload",
                "$ref": "#/components/schemas/ConversationClosedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook event received successfully."
          },
          "204": {
            "description": "Webhook event received successfully; no response body."
          }
        }
      }
    },
    "BUTLER_GROUP_CREATED": {
      "post": {
        "summary": "Chat Group Created",
        "operationId": "onButlerGroupCreated",
        "tags": [
          "Chat Group/Events"
        ],
        "description": "Triggered when 3Chat creates a chat group. A chat group describes a group or discussion group from a connected messaging channel. Every chat group has a corresponding group-type Dialog that contains its messages and Conversations.\n\n## Prerequisites\n\nCreate a Webhook application in **Open Platform → Webhook**, configure its receiving URL, and subscribe to `BUTLER_GROUP_CREATED`.\n\n## When is this event triggered?\n\n3Chat creates the chat group when it receives the first message from a previously unknown third-party group chat. At the same time, 3Chat creates the corresponding group-type Dialog if it does not already exist. This event is then delivered to subscribed developer servers.",
        "security": [],
        "parameters": [
          {
            "name": "TENANT_ID",
            "in": "header",
            "required": true,
            "description": "ID of the tenant associated with this event.",
            "schema": {
              "type": "string"
            },
            "example": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
          },
          {
            "name": "STAFF_ID",
            "in": "header",
            "required": false,
            "description": "ID of the staff member associated with the event, when applicable.",
            "schema": {
              "type": "string"
            },
            "example": "123123"
          },
          {
            "name": "x-nct-time",
            "in": "header",
            "required": true,
            "description": "Timestamp when the event was generated.",
            "schema": {
              "type": "string"
            },
            "example": "1750351569887"
          },
          {
            "name": "business-type",
            "in": "header",
            "required": true,
            "description": "Business type code for the Chat Group Created event.",
            "schema": {
              "type": "string",
              "const": "15036"
            },
            "example": "15036"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "JSON payload delivered to the configured webhook URL.",
          "content": {
            "application/json": {
              "schema": {
                "title": "Chat Group Created event payload",
                "$ref": "#/components/schemas/ChatGroupCreatedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook event received successfully."
          },
          "204": {
            "description": "Webhook event received successfully; no response body."
          }
        }
      }
    },
    "BUTLER_GROUP_UPDATED": {
      "post": {
        "summary": "Chat Group Updated",
        "operationId": "onButlerGroupUpdated",
        "tags": [
          "Chat Group/Events"
        ],
        "description": "Triggered when information about an existing chat group changes in 3Chat. A chat group describes a group or discussion group from a connected messaging channel, and every chat group has a corresponding group-type Dialog.\n\n## Prerequisites\n\nCreate a Webhook application in **Open Platform → Webhook**, configure its receiving URL, and subscribe to `BUTLER_GROUP_UPDATED`.\n\n## When is this event triggered?\n\nThe event is emitted when 3Chat updates chat-group information such as its name, avatar, external identifier, connected channel, or custom fields. The group-type Dialog remains the container for messages and Conversations associated with the group.",
        "security": [],
        "parameters": [
          {
            "name": "TENANT_ID",
            "in": "header",
            "required": true,
            "description": "ID of the tenant associated with this event.",
            "schema": {
              "type": "string"
            },
            "example": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
          },
          {
            "name": "STAFF_ID",
            "in": "header",
            "required": false,
            "description": "ID of the staff member associated with the event, when applicable.",
            "schema": {
              "type": "string"
            },
            "example": "123123"
          },
          {
            "name": "x-nct-time",
            "in": "header",
            "required": true,
            "description": "Timestamp when the event was generated.",
            "schema": {
              "type": "string"
            },
            "example": "1750351569887"
          },
          {
            "name": "business-type",
            "in": "header",
            "required": true,
            "description": "Business type code for the Chat Group Updated event.",
            "schema": {
              "type": "string",
              "const": "15037"
            },
            "example": "15037"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "JSON payload delivered to the configured webhook URL.",
          "content": {
            "application/json": {
              "schema": {
                "title": "Chat Group Updated event payload",
                "$ref": "#/components/schemas/ChatGroupUpdatedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook event received successfully."
          },
          "204": {
            "description": "Webhook event received successfully; no response body."
          }
        }
      }
    },
    "BUTLER_MESSAGE_CREATED": {
      "post": {
        "summary": "Message Created",
        "operationId": "onButlerMessageCreated",
        "tags": [
          "Message/Events"
        ],
        "description": "Triggered whenever a new message is created in 3Chat. Every inbound or outbound message recorded by 3Chat emits this event, including messages sent by a Contact, a human agent, the 3Chat AI agent, or the system.\n\n## Prerequisites\n\nCreate a Webhook application in **Open Platform → Webhook**, configure its receiving URL, and subscribe to `BUTLER_MESSAGE_CREATED`.\n\n## What does the event contain?\n\nThe payload identifies the sender, channel, Dialog, and Conversation; includes the message content, timestamps, attachments, and email metadata when applicable; and may include AI-agent execution logs for messages processed by an AI agent.",
        "security": [],
        "parameters": [
          {
            "name": "TENANT_ID",
            "in": "header",
            "required": true,
            "description": "ID of the tenant associated with this event.",
            "schema": {
              "type": "string"
            },
            "example": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
          },
          {
            "name": "STAFF_ID",
            "in": "header",
            "required": false,
            "description": "ID of the staff member associated with the event, when applicable.",
            "schema": {
              "type": "string"
            },
            "example": "123123"
          },
          {
            "name": "x-nct-time",
            "in": "header",
            "required": true,
            "description": "Timestamp when the event was generated.",
            "schema": {
              "type": "string"
            },
            "example": "1750351569887"
          },
          {
            "name": "business-type",
            "in": "header",
            "required": true,
            "description": "Business type code for the Message Created event.",
            "schema": {
              "type": "string",
              "const": "15016"
            },
            "example": "15016"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "JSON payload delivered to the configured webhook URL.",
          "content": {
            "application/json": {
              "schema": {
                "title": "Message Created event payload",
                "$ref": "#/components/schemas/MessageCreatedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook event received successfully."
          },
          "204": {
            "description": "Webhook event received successfully; no response body."
          }
        }
      }
    }
  }
}