สร้างทิกเก็ต
นักพัฒนาสามารถสร้างทิกเก็ตผ่าน API ได้ และหลังจากสร้างทิกเก็ตสำเร็จ ระบบจะส่งคืนรหัสทิกเก็ต
เมธอดคำขอ
POST
Endpoint
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": "Printer paper jam, unable to print",
"description": "The customer reported that A4 paper is stuck at the paper outlet and requires urgent attention.",
"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": "Zhang San"
}
]
}
},
"submitter": {
"id": "u_12345"
},
"assignment_team": "IT Support",
"priority": "high",
"ticket_type": "incident",
"custom_fields": {
"device_sn": "PRN-2024-001",
"location": "Beijing Headquarters—3rd Floor Printer Room"
}
}'
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": "Printer paper jam, unable to print",
"description": "The customer reported that A4 paper is stuck at the paper outlet and requires urgent attention.",
"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": "Zhang San"
}
]
}
},
"submitter": {
"id": "u_12345"
},
"assignment_team": "IT Support",
"priority": "high",
"ticket_type": "incident",
"custom_fields": {
"device_sn": "PRN-2024-001",
"location": "Beijing Headquarters—3rd Floor Printer Room"
}
}'
โค้ดนี้โชว์เป็นหน้าต่างลอย
เฮดเดอร์คำขอ
| Field | Type | Description |
|---|---|---|
| Authorization | string | ใช้สำหรับยืนยันตัวตนในรูปแบบ Authorization: Basic base64(API Key:API Secret) โดยไปที่หน้าคีย์ API เพื่อรับ API Key และ API Secret จากนั้นเชื่อมทั้งสองค่าด้วยเครื่องหมายโคลอน (:) และเข้ารหัสด้วย Base64 |
| Content-Type | application/json | ประเภทข้อมูล โดยค่าต้องเป็น application/json |
พารามิเตอร์ใน Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| title | String | Yes | ชื่อทิกเก็ต |
| description | String | No | คำอธิบายทิกเก็ต รองรับรูปแบบ Markdown |
| attachments | Array | No | อาร์เรย์ของไฟล์แนบ โดยต้องอัปโหลดไฟล์ผ่าน /upload ก่อน |
| file_url | String | Yes | URL ของไฟล์ |
| requester | Object | Yes | ข้อมูลผู้ส่งคำขอ |
| euid | String | No | รหัสผู้ติดต่อแบบไม่ซ้ำกัน |
| channel_contacts | Object | No | การแมปผู้ติดต่อของช่องทาง โดยต้องระบุอย่างน้อยหนึ่งรายการระหว่าง euid และฟิลด์นี้ |
| channel_id | String | Yes | รหัสช่องทาง |
| contact_id | String | Yes | รหัสผู้ติดต่อของช่องทาง เช่น Telegram chat ID |
| sub_contact_id | String | No | รหัสผู้ติดต่อย่อยของช่องทาง เช่น Telegram topic ID หรือ email thread ID |
| followers | Array | No | ข้อมูลรหัสผู้ติดตามที่ใช้สำหรับการพุชและการแจ้งเตือนภายในช่องทาง โดยประกอบด้วยฟิลด์ id และ nameid: รหัสผู้ติดตามname: ชื่อผู้ติดตาม |
| submitter | Object | No | ข้อมูลผู้ส่ง โดยประกอบด้วยฟิลด์ idid: รหัสผู้ส่ง |
| assignment_team | String | No | ชื่อทีมที่มอบหมาย โดยทีมดังกล่าวต้องมีอยู่แล้ว |
| priority | String | No | ระดับความสำคัญ: high, medium หรือ low หากไม่ระบุ ค่าเริ่มต้นคือ medium |
| ticket_type | String | No | ประเภททิกเก็ต: problem, incident, question, task หรือ none หากไม่ระบุ ค่าเริ่มต้นคือ none |
| custom_fields | Object | No | ฟิลด์แบบกำหนดเอง เช่น ข้อมูลแหล่งที่มา โดยใช้รูปแบบคีย์-ค่า |
การตอบกลับ
การตอบกลับเมื่อสำเร็จ
{
"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"
}
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
พารามิเตอร์การตอบกลับ
| Field | Type | Required | Description |
|---|---|---|---|
| ticket_id | String | No | รหัสทิกเก็ต |
| message | String | No | ข้อความที่ส่งกลับ เช่น "Ticket created successfully" |










