Preview: API ยังอยู่ระหว่างเปิดใช้ รายละเอียดอาจเปลี่ยนก่อนเปิดจริง ดูความคืบหน้าที่ บันทึกการเปลี่ยนแปลง
บอท (me)
me คือบอทเจ้าของ token ที่ส่งมา endpoint ในหน้านี้จึงไม่ต้องใส่ id ของบอทใน path
ข้อมูลบอท
หัวข้อที่มีชื่อว่า “ข้อมูลบอท”GET /v1/me
curl -s https://api.sukson.dev/v1/me -H "Authorization: Bearer $SUKSON_BOT_TOKEN"{ "id": "01933b40-1a2b-7c3d-8e4f-5a6b7c8d9e0f", "handle": "weather_bot", "name": "WeatherBot", "status": "active", "commands": [{ "command": "weather", "description": "พยากรณ์อากาศ" }]}| ฟิลด์ | คำอธิบาย |
|---|---|
id |
id สาธารณะของบอท เท่ากับ bot.id ใน event |
handle |
ชื่อสำหรับ @mention |
name |
ชื่อที่แสดง |
status |
active หรือ paused (บอทหยุดเองเพราะส่ง webhook ล้มเหลวติดกัน) บอทที่ถูกปิดหรือถูกแบนเรียก API ไม่ได้ (403 BOT_DISABLED) |
commands |
รายการคำสั่งที่ประกาศไว้ |
โควตารายเดือน
หัวข้อที่มีชื่อว่า “โควตารายเดือน”GET /v1/me/quota
{ "type": "limited", "value": 300, "period": "2026-11", "plan": { "code": "free", "name": "ทั่วไป", "expires_at": null }, "entitlements": { "attachments_max": 3, "messages_monthly": 300, "can_see_all_messages": false }}| ฟิลด์ | คำอธิบาย |
|---|---|
value |
จำนวนข้อความต่อเดือน (event ที่ส่งไป + ข้อความที่บอทโพสต์) |
period |
เดือนปัจจุบันตามเวลาประเทศไทย (YYYY-MM) โควตาเริ่มใหม่วันที่ 1 เวลา 00:00 น. |
plan |
แพ็กเกจของบอท expires_at เป็น null ถ้าไม่มีวันหมดอายุ |
entitlements.attachments_max |
จำนวนห้องที่บอทอยู่ได้พร้อมกัน |
entitlements.can_see_all_messages |
เจ้าของห้องเปิดโหมด “เห็นทุกข้อความ” ให้บอทนี้ได้หรือไม่ |
ยอดใช้เดือนนี้
หัวข้อที่มีชื่อว่า “ยอดใช้เดือนนี้”GET /v1/me/quota/consumption
{ "period": "2026-11", "total_usage": 128, "dispatched": 71, "posted": 57 }| ฟิลด์ | คำอธิบาย |
|---|---|
total_usage |
ยอดรวมที่นับกับโควตา (dispatched + posted) |
dispatched |
event ที่ส่งไปที่ webhook |
posted |
ข้อความที่บอทโพสต์ (ทั้ง {"reply"}, reply token และ push) |
ตั้งคำสั่ง
หัวข้อที่มีชื่อว่า “ตั้งคำสั่ง”PUT /v1/me/commands
คำสั่งคือคำที่ขึ้นต้นด้วย / ที่สมาชิกพิมพ์เพื่อสั่งบอท endpoint นี้แทนที่รายการคำสั่งทั้งหมดในครั้งเดียว ส่ง [] เพื่อล้าง เมื่อสมาชิกพิมพ์ /weather หรือ /weather@weather_bot บอทจะได้ event ที่ trigger เป็น command
curl -s -X PUT https://api.sukson.dev/v1/me/commands \ -H "Authorization: Bearer $SUKSON_BOT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"commands":[{"command":"weather","description":"พยากรณ์อากาศ"},{"command":"help","description":"วิธีใช้บอท"}]}'| ฟิลด์ | กติกา |
|---|---|
commands |
จำเป็น, ไม่เกิน 50 รายการ |
commands[].command |
a–z, 0–9, _ ยาว 1–32 ตัว ห้ามซ้ำ ไม่ต้องใส่ / |
commands[].description |
ไม่เกิน 100 ตัวอักษร |
คำตอบ:
{ "commands": [{ "command": "weather", "description": "พยากรณ์อากาศ" }, { "command": "help", "description": "วิธีใช้บอท" }] }ข้อผิดพลาดที่พบบ่อย: 422 INVALID (details.fields บอกฟิลด์ เช่น ["commands.0.command"]), 422 UNKNOWN_FIELD