logo文件
搜尋

創建工單

開發者可以通過 API 創建工單,工單創建後,會返回工單 ID。

請求方式

POST

調用地址

https://livedesk-api.engagelab.com/api/v2/accounts/tickets

調用驗證

詳情參見 API 概述的鑑權方式說明。

請求

請求示例

curl -X POST 'https://livedesk-api.engagelab.com/api/v2/accounts/tickets' \ -H 'Content-Type: application/json' \ -H 'Authorization: Basic base64(api_key:api_secret)' \ -d '{ "title": "打印機卡紙,無法打印", "description": "客戶反映 A4 紙卡在出紙口,急需處理。", "attachments": [ { "file_url": "https://example.com/files/error.jpg" } ], "requester": { "euid": "contact_12345", "channel_contacts": { "channel_id": "inbox_100", "contact_id": "-1001234567890", "sub_contact_id": "23232323", "followers": [ { "id": "7562646527", "name": "張三" } ] } }, "submitter": { "id": "u_12345" }, "assignment_team": "IT 支持", "priority": "high", "ticket_type": "incident", "custom_fields": { "device_sn": "PRN-2024-001", "location": "北京總部-3 樓打印室" } }'
              
              curl -X POST 'https://livedesk-api.engagelab.com/api/v2/accounts/tickets' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic base64(api_key:api_secret)' \
-d '{
  "title": "打印機卡紙,無法打印",
  "description": "客戶反映 A4 紙卡在出紙口,急需處理。",
  "attachments": [
    {
      "file_url": "https://example.com/files/error.jpg"
    }
  ],
  "requester": {
    "euid": "contact_12345",
    "channel_contacts": {
      "channel_id": "inbox_100",
      "contact_id": "-1001234567890",
      "sub_contact_id": "23232323",
      "followers": [
        {
          "id": "7562646527",
          "name": "張三"
        }
      ]
    }
  },
  "submitter": {
    "id": "u_12345"
  },
  "assignment_team": "IT 支持",
  "priority": "high",
  "ticket_type": "incident",
  "custom_fields": {
    "device_sn": "PRN-2024-001",
    "location": "北京總部-3 樓打印室"
  }
}'

            
此代碼塊在浮窗中顯示

請求頭

欄位 類型 描述
Authorization string 使用 Authorization: Basic base64(API Key:API Secret) 進行身份驗證。請前往 API 密鑰頁面 獲取 API Key 和 API Secret,並將兩者以冒號連接後進行 Base64 編碼。
Content-Type application/json 數據類型,取值為 application/json。

請求體參數

欄位 類型 必填 描述
title String 工單標題。
description String 工單內容描述,支持 md 格式。
attachments Array 附件陣列,需先通過 /upload 上傳。
file_url String 文件地址。
requester Object 請求者資訊。
euid String 聯絡人唯一 ID。
channel_contacts Object 渠道聯絡人映射(與 euid 至少存在一個)。
channel_id String 渠道 ID。
contact_id String 渠道聯絡人 ID(如 TG 的 chat_id)。
sub_contact_id String 渠道子聯絡人 ID(如 TG 的 topic_id / Email thread_id)。
followers Array 關注者 ID 資訊(用於渠道內推送/通知),包含 id 和 name 欄位。
  • id: 關注者 ID。
  • name: 關注者名稱。
  • submitter Object 提交者 ID(內部成員帳號 ID),包含 id 欄位。
  • id: 提交者 ID。
  • assignment_team String 分配團隊名稱(需已存在)。
    priority String 優先級:high/medium/low,不傳默認為 medium。
    ticket_type String 工單類型:problem/incident/question/task/None,不傳默認為 None。
    custom_fields Object 自定義欄位(來源資訊等),使用 key-value 格式。

    響應示例

    成功響應

    { "code": 0, "message": "Success", "data": { "ticket_id": "tk_20251104_789abc", "message": "Ticket created successfully" } }
                  
                  {
      "code": 0,
      "message": "Success",
      "data": {
        "ticket_id": "tk_20251104_789abc",
        "message": "Ticket created successfully"
      }
    }
    
                
    此代碼塊在浮窗中顯示

    響應參數

    欄位 類型 必填 描述
    ticket_id String 工單 ID.
    message String 返回消息內容。eg:"Ticket created successfully"
    icon
    聯繫銷售