เอกสารอ้างอิง API
Webhook EndpointPOST

สร้าง จุดเชื่อมต่อ Webhook

สร้างผู้รับ Webhook subscribed_events รับเฉพาะชื่อ event มาตรฐานของแพลตฟอร์ม (เช่น message.received, account.status.updated) ใช้ ["*"] เพื่อ subscribe ทุก event ชื่อ event ที่ไม่รู้จักจะถูกปฏิเสธ signing_secret เป็นแบบเลือก หากไม่ระบุหรือว่างจะปิดการลงนามสำหรับ จุดเชื่อมต่อ นี้ retry_policy.max_attempts ต้องเป็นจำนวนเต็มไม่ติดลบ ค่า 0 หมายถึงปิดการ retry ค่าที่ไม่ใช่จำนวนเต็มจะถูกปฏิเสธ

https://api.unifyport.ai/v1/webhook-endpoints

ส่วนหัว

X-Api-Key
stringจำเป็น

API key ของพื้นที่ทำงาน ระบบจะระบุพื้นที่ทำงานจากส่วนหัวนี้

Content-Type
stringจำเป็น

ใช้ application/json เมื่อต้องส่งเนื้อหาของคำขอเป็น JSON

พารามิเตอร์ใน path

จุดเชื่อมต่อนี้ไม่มีพารามิเตอร์ใน path

เนื้อหาของคำขอ

url
stringจำเป็น

จุดเชื่อมต่อ HTTPS ที่รับ event ของ Webhook

status
string

สถานะ จุดเชื่อมต่อ โดยทั่วไปคือ active หรือ inactive

subscribed_events
string[]

ประเภท event ที่ส่งไปยัง จุดเชื่อมต่อ ใช้ ["*"] เพื่อ subscribe ทุก event ดูชื่อ event ทั้งหมดได้ที่ แคตตาล็อก event มาตรฐาน

signing_secret
string

secret สำหรับลงนาม Webhook แบบเลือก ในตัวอย่างให้ใช้ค่าตัวแทน

retry_policy
object

การตั้งค่า retry เช่น max_attempts

เนื้อหาการตอบกลับ

id
string

ตัวระบุ จุดเชื่อมต่อ Webhook (we_...)

url
string

URL แบบ HTTPS ที่รับการนำส่ง Webhook

status
string

สถานะ จุดเชื่อมต่อ: active หรือ inactive

subscribed_events
string[]

ประเภท event ที่ส่งไปยัง จุดเชื่อมต่อ; ["*"] หมายถึงทุก event

signing_enabled
boolean

เป็น true เมื่อมีการตั้ง signing secret และการนำส่งถูกลงนาม

retry_policy
object

การตั้งค่า retry เช่น max_attempts

การตอบกลับ

201
201 Created

คำขอสำเร็จ ดูตัวอย่างเนื้อหาตอบกลับด้านบน

400
Bad Request

เนื้อหาของคำขอ path หรือพารามิเตอร์ไม่ถูกต้อง

401
Unauthorized

ส่วนหัว X-Api-Key หายไปหรือไม่ถูกต้อง

409
Conflict

การดำเนินการขัดแย้งกับบัญชีของผู้ให้บริการหรือทรัพยากรที่มีอยู่

500
Internal Server Error

บริการพบข้อผิดพลาดที่ไม่คาดคิด

คำขอ

curl -X POST https://api.unifyport.ai/v1/webhook-endpoints \
  -H "X-Api-Key: <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://example.com/webhook",
  "status": "active",
  "subscribed_events": ["*"],
  "signing_secret": "<WEBHOOK_SIGNING_SECRET>"
}'

การตอบกลับ

{
  "data": {
    "id": "we_example",
    "url": "https://example.com/webhook",
    "status": "active",
    "subscribed_events": ["*"],
    "signing_enabled": true,
    "retry_policy": {
      "max_attempts": 3
    }
  }
}