สร้างบทสนทนา
นักพัฒนาสามารถสร้างบทสนทนาสำหรับผู้ติดต่อที่ระบุผ่าน API ได้
วิธีการร้องขอ
POST
URL สำหรับการร้องขอ
https://livedesk-api.engagelab.com/api/v2/accounts/conversations
การยืนยันตัวตน
สำหรับรายละเอียด โปรดดูคำอธิบายวิธีการยืนยันตัวตนใน ภาพรวม API
คำขอ
ตัวอย่างคำขอ
curl -X POST https://livedesk-api.engagelab.com/api/v2/accounts/conversations \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic base64(api_key:api_secret)' \
{
"inbox_id": 407, // จำเป็น
"contact_id": 2219256, // สามารถส่ง contact_id หรือ source_id อย่างใดอย่างหนึ่งได้ แต่ต้องแน่ใจว่าสามารถระบุผู้ส่งได้อย่างถูกต้อง
"source_id": "123456789"
}
curl -X POST https://livedesk-api.engagelab.com/api/v2/accounts/conversations \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic base64(api_key:api_secret)' \
{
"inbox_id": 407, // จำเป็น
"contact_id": 2219256, // สามารถส่ง contact_id หรือ source_id อย่างใดอย่างหนึ่งได้ แต่ต้องแน่ใจว่าสามารถระบุผู้ส่งได้อย่างถูกต้อง
"source_id": "123456789"
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
พารามิเตอร์ส่วนหัวของคำขอ
| Field | Type | Description |
|---|---|---|
| Authorization | string | ใช้ Authorization: Basic base64(API Key:API Secret) สำหรับการยืนยันตัวตน โปรดไปที่หน้า API Key เพื่อรับ API Key และ API Secret จากนั้นเชื่อมทั้งสองค่าด้วยเครื่องหมายโคลอนแล้วเข้ารหัสด้วย Base64 |
| Content-Type | application/json | ประเภทข้อมูล สำหรับข้อความธรรมดาให้ใช้ application/json |
พารามิเตอร์ใน Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| inbox_id | String | Yes | ID ของช่องทาง ตรงกับ ID ที่ใช้ในอินเทอร์เฟซสร้างผู้ติดต่อ |
| contact_id | String | No | ID ผู้ติดต่อ คือ id ใน response ของอินเทอร์เฟซสร้างผู้ติดต่อ |
| source_id | String | No | ID ของแหล่งที่มา |
การตอบกลับ
ตัวอย่างการตอบกลับ
{
"meta": {
"sender": {
"additional_attributes": {},
"availability_status": "offline",
"email": null,
"id": 2219256,
"name": "wjTest",
"phone_number": null,
"blocked": false,
"identifier": null,
"thumbnail": "",
"custom_attributes": {},
"created_at": 1766571624
},
"channel": "Channel::Api",
"hmac_verified": false
},
"id": 40,
"messages": [],
"account_id": 17623000010928,
"uuid": "660ce36f-46bb-4153-948c-8a26e6dab634",
"inbox_id": 407,
"additional_attributes": {},
"agent_last_seen_at": 0,
"assignee_last_seen_at": 0,
"can_reply": true,
"contact_last_seen_at": 0,
"custom_attributes": {},
"labels": [],
"muted": false,
"snoozed_until": null,
"status": "open",
"priority": null,
"conversation_category": "chat",
"chat_mode": "private_chat",
"is_forum": false,
"created_at": 1766572062,
"updated_at": 1766572062.5803902,
"timestamp": 1766572062,
"first_reply_created_at": 0,
"unread_count": 0,
"last_non_activity_message": null,
"last_activity_at": 1766572062,
"waiting_since": 1766572062,
"sla_policy_id": null,
"ticket_id": null,
"over_limit": false,
"content_preview": {
"content": null,
"message_type": null,
"created_at": null
},
"platform": {
"channel_type": "Channel::Api",
"inbox_name": "JennyApi",
"inbox_id": 407
},
"account_info": {
"contact_name": "wjTest",
"contact_email": null,
"contact_phone": null,
"contact_id": 2219256,
"contact_avatar": ""
},
"assignment": {
"assignee_id": null,
"assignee_name": null,
"assignee_email": null,
"team_id": null,
"team_name": null
}
}
{
"meta": {
"sender": {
"additional_attributes": {},
"availability_status": "offline",
"email": null,
"id": 2219256,
"name": "wjTest",
"phone_number": null,
"blocked": false,
"identifier": null,
"thumbnail": "",
"custom_attributes": {},
"created_at": 1766571624
},
"channel": "Channel::Api",
"hmac_verified": false
},
"id": 40,
"messages": [],
"account_id": 17623000010928,
"uuid": "660ce36f-46bb-4153-948c-8a26e6dab634",
"inbox_id": 407,
"additional_attributes": {},
"agent_last_seen_at": 0,
"assignee_last_seen_at": 0,
"can_reply": true,
"contact_last_seen_at": 0,
"custom_attributes": {},
"labels": [],
"muted": false,
"snoozed_until": null,
"status": "open",
"priority": null,
"conversation_category": "chat",
"chat_mode": "private_chat",
"is_forum": false,
"created_at": 1766572062,
"updated_at": 1766572062.5803902,
"timestamp": 1766572062,
"first_reply_created_at": 0,
"unread_count": 0,
"last_non_activity_message": null,
"last_activity_at": 1766572062,
"waiting_since": 1766572062,
"sla_policy_id": null,
"ticket_id": null,
"over_limit": false,
"content_preview": {
"content": null,
"message_type": null,
"created_at": null
},
"platform": {
"channel_type": "Channel::Api",
"inbox_name": "JennyApi",
"inbox_id": 407
},
"account_info": {
"contact_name": "wjTest",
"contact_email": null,
"contact_phone": null,
"contact_id": 2219256,
"contact_avatar": ""
},
"assignment": {
"assignee_id": null,
"assignee_name": null,
"assignee_email": null,
"team_id": null,
"team_name": null
}
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
พารามิเตอร์การตอบกลับ
| Field | Type | Required | Description |
|---|---|---|---|
| meta | Object | No | อ็อบเจ็กต์เมทาดาทา |
| sender | Object | No | ข้อมูลผู้ส่ง |
| additional_attributes | Object | No | คุณสมบัติเพิ่มเติม |
| availability_status | String | No | สถานะการออนไลน์ |
| Null | No | อีเมล | |
| id | Number | No | ID ผู้ติดต่อ |
| name | String | No | ชื่อผู้ส่ง |
| phone_number | Null | No | หมายเลขโทรศัพท์ |
| blocked | Boolean | No | ถูกบล็อกหรือไม่ |
| identifier | Null | No | ตัวระบุแอตทริบิวต์ผู้ใช้ |
| thumbnail | String | No | ภาพย่อ |
| custom_attributes | Object | No | คุณสมบัติแบบกำหนดเอง |
| created_at | Number | No | เวลาสร้างบทสนทนา |
| channel | String | No | ประเภทช่องทาง |
| hmac_verified | Boolean | No | สถานะการตรวจสอบ HMAC |
| id | Number | No | ID บทสนทนา |
| messages | Array | No | อาร์เรย์ของข้อความ |
| account_id | Number | No | ID โปรเจกต์ |
| uuid | String | No | ตัวระบุที่ไม่ซ้ำ |
| inbox_id | Number | No | ID ช่องทาง |
| additional_attributes | Object | No | คุณสมบัติเพิ่มเติม |
| agent_last_seen_at | Number | No | เวลาที่เอเจนต์ออนไลน์ล่าสุด |
| assignee_last_seen_at | Number | No | เวลาที่ผู้รับมอบหมายออนไลน์ล่าสุด |
| can_reply | Boolean | No | สามารถตอบกลับได้หรือไม่ |
| contact_last_seen_at | Number | No | เวลาที่ผู้ติดต่อออนไลน์ล่าสุด |
| custom_attributes | Object | No | คุณสมบัติแบบกำหนดเอง |
| labels | Array | No | อาร์เรย์ของป้ายกำกับ |
| muted | Boolean | No | ปิดการแจ้งเตือนหรือไม่ |
| snoozed_until | Null | No | พักการแจ้งเตือนถึงเวลาใด |
| status | String | No | สถานะ |
| priority | Null | No | ลำดับความสำคัญ |
| conversation_category | String | No | หมวดหมู่บทสนทนา |
| chat_mode | String | No | โหมดแชต |
| is_forum | Boolean | No | เป็นฟอรัมหรือไม่ |
| created_at | Number | No | เวลาที่สร้าง |
| updated_at | Number | No | เวลาที่อัปเดต |
| timestamp | Number | No | Timestamp |
| first_reply_created_at | Number | No | เวลาที่สร้างการตอบกลับครั้งแรก |
| unread_count | Number | No | จำนวนข้อความที่ยังไม่ได้อ่าน |
| last_non_activity_message | Null | No | ข้อความล่าสุดที่ไม่ใช่กิจกรรมระบบ |
| last_activity_at | Number | No | เวลากิจกรรมล่าสุด |
| waiting_since | Number | No | เวลาเริ่มรอ |
| sla_policy_id | Null | No | ID นโยบาย SLA |
| ticket_id | Null | No | ID ทิกเก็ต |
| over_limit | Boolean | No | เกินขีดจำกัดหรือไม่ |
| content_preview | Object | No | ตัวอย่างเนื้อหา |
| content_preview.content | Null | No | เนื้อหาตัวอย่าง |
| content_preview.message_type | Null | No | ประเภทข้อความ |
| content_preview.created_at | Null | No | เวลาที่สร้าง |
| platform | Object | No | ข้อมูลแพลตฟอร์ม |
| channel_type | String | No | ประเภทช่องทาง |
| inbox_name | String | No | ชื่อกล่องข้อความ |
| inbox_id | Number | No | ID กล่องข้อความ |
| account_info | Object | No | ข้อมูลบัญชี |
| contact_name | String | No | ชื่อผู้ติดต่อ |
| contact_email | Null | No | อีเมลผู้ติดต่อ |
| contact_phone | Null | No | เบอร์โทรผู้ติดต่อ |
| contact_id | Number | No | ID ผู้ติดต่อ |
| contact_avatar | String | No | รูปโปรไฟล์ผู้ติดต่อ |
| assignment | Object | No | ข้อมูลการมอบหมาย |
| assignee_id | Null | No | ID ผู้รับมอบหมาย |
| assignee_name | Null | No | ชื่อผู้รับมอบหมาย |
| assignee_email | Null | No | อีเมลผู้รับมอบหมาย |
| team_id | Null | No | ID ทีม |
| team_name | Null | No | ชื่อทีม |










