รับรายการสนทนา

รับรายการสนทนา

ดึงข้อมูลสนทนาทั้งหมดของ Agent ตามเงื่อนไขตัวกรองที่ระบุ เช่น conversation_id, user_id, เวลาสนทนาล่าสุด, หัวข้อ, ประเภทสนทนา, จำนวนข้อความ และเครดิตที่ใช้

วิธีการร้องขอ

GET

URL สำหรับร้องขอ

https://api-${endpoint}.gptbots.ai/v1/bot/conversation/page

การยืนยันตัวตน

โปรดดูวิธีการยืนยันตัวตนได้ที่ API Overview

การร้องขอ

ตัวอย่างการร้องขอ

curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/bot/conversation/page?page=1&conversation_type=API&start_time=1691942400000&end_time=1699868066999&page_size=50&user_id=1234567890' \ -H 'Authorization: Bearer ${API Key}' \
                      
                      curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/bot/conversation/page?page=1&conversation_type=API&start_time=1691942400000&end_time=1699868066999&page_size=50&user_id=1234567890'  \
-H 'Authorization: Bearer ${API Key}' \

                    
บล็อกโค้ดนี้ในหน้าต่างลอย

ส่วนหัวของคำร้องขอ

ฟิลด์ ประเภท คำอธิบาย
Authorization Bearer ${API Key} ใช้ Authorization: Bearer ${API Key} เพื่อยืนยันตัวตน รับ API Key ได้จากหน้า API Key

พารามิเตอร์สำหรับร้องขอ

ฟิลด์ ประเภท จำเป็น คำอธิบาย
conversation_type string ใช่ ประเภทแหล่งที่มาของ Conversation ID เลือกได้: ALL, API, EMBED หรือประเภทอื่น ๆ
user_id string ไม่จำเป็น รหัสผู้ใช้ ถ้าไม่ระบุจะแสดงทั้งหมด
start_time long ใช่ เวลาเริ่มต้นของสนทนาล่าสุด (timestamp)
end_time long ใช่ เวลาสิ้นสุดของสนทนาล่าสุด (timestamp)
page int ใช่ หมายเลขหน้า เริ่มต้นที่ 1
page_size int ใช่ จำนวนรายการต่อหน้า (1-100)

หมายเหตุ: ดูค่าที่เป็นไปได้ของ conversation_type ได้ที่ รายการค่าฟิลด์แหล่งที่มาของ Conversation ID (conversation_id) ในตารางของ User Overview

การตอบกลับ

ตัวอย่างการตอบกลับ

{ "list": [ { "conversation_id": "AaACmo05Yrqb6bOSTbsg", "user_id": "3", "recent_chat_time": 1694572952383, "subject": "2+3=?", "conversation_type": "API", "message_count": 2, "cost_credit": 0.01, "bot_id": "64b902a84f1ff25d1c60c10b" }, { "conversation_id": "64ec1508c9c1ed5605e6ff28", "user_id": "33", "recent_chat_time": 1693194862160, "subject": "Hello!", "conversation_type": "API", "message_count": 20, "cost_credit": 0.59, "bot_id": "64b902a84f1ff25d1c60c10b" } ], "total": 2 }
                      
                      {
  "list": [
    {
      "conversation_id": "AaACmo05Yrqb6bOSTbsg",
      "user_id": "3",
      "recent_chat_time": 1694572952383,
      "subject": "2+3=?",
      "conversation_type": "API",
      "message_count": 2,
      "cost_credit": 0.01,
      "bot_id": "64b902a84f1ff25d1c60c10b"
    },
    {
      "conversation_id": "64ec1508c9c1ed5605e6ff28",
      "user_id": "33",
      "recent_chat_time": 1693194862160,
      "subject": "Hello!",
      "conversation_type": "API",
      "message_count": 20,
      "cost_credit": 0.59,
      "bot_id": "64b902a84f1ff25d1c60c10b"
    }
  ],
  "total": 2
}

                    
บล็อกโค้ดนี้ในหน้าต่างลอย

การตอบกลับเมื่อสำเร็จ

ฟิลด์ ประเภท คำอธิบาย
list JSON Array รายการสนทนา
conversation_id string รหัสสนทนา
user_id string รหัสผู้ใช้
recent_chat_time long เวลาสนทนาล่าสุด
subject string หัวข้อสนทนา
conversation_type string ประเภทสนทนา
message_count int จำนวนข้อความในสนทนา
cost_credit float เครดิตที่ใช้ในสนทนา
bot_id string รหัส Agent
total int จำนวนสนทนาทั้งหมดที่ส่งกลับ

การตอบกลับเมื่อเกิดข้อผิดพลาด

ฟิลด์ ประเภท คำอธิบาย
code int รหัสข้อผิดพลาด
message string รายละเอียดข้อผิดพลาด

รหัสข้อผิดพลาด

รหัส ข้อความ
40000 พารามิเตอร์ไม่ถูกต้อง
20059 Agent ถูกลบ