Developers

PropThunder API

เชื่อมระบบของคุณกับ PropThunder: ส่งลูกค้าจากเว็บไซต์หรือแบบฟอร์มของคุณเข้ามาอัตโนมัติ ดึงรายการประกาศไปแสดงที่อื่น และรับเหตุการณ์แบบเรียลไทม์ผ่าน Webhook

Base URL: https://propthunder.com/api/v1

คู่มือ API และ Webhook แบบทีละขั้น

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

สร้าง API key ได้ที่ การเชื่อมต่อ → API และ Webhook (เฉพาะเจ้าของบัญชีหรือเจ้าของทีม) แล้วส่งใน header Authorization ทุกครั้ง key จะเห็นได้ครั้งเดียวตอนสร้าง เก็บให้ปลอดภัยและอย่าใส่ในโค้ดฝั่งเบราว์เซอร์

curl https://propthunder.com/api/v1/contacts?limit=10 \
  -H "Authorization: Bearer pt_live_..."

ขีดจำกัดและรูปแบบ

Endpoints

GET/api/v1/contacts

รายชื่อลูกค้า ค้นด้วย ?q= (ชื่อ/เบอร์/อีเมล) และกรอง ?stage_id=

POST/api/v1/contacts

เพิ่มลูกค้าใหม่ เข้าขั้นแรกของ pipeline และส่งเหตุการณ์ contact.created (Workflow ทำงานด้วย)

curl -X POST https://propthunder.com/api/v1/contacts \
  -H "Authorization: Bearer pt_live_..." \
  -H "Content-Type: application/json" \
  -d '{"name":"สมหญิง ใจดี","phone":"0812345678","interest":"buy","budget_max":5000000,"tags":["website"],"notes":"สนใจคอนโดใกล้ BTS"}'

GET/api/v1/contacts/{id}

ดูลูกค้าหนึ่งคน

PATCH/api/v1/contacts/{id}

แก้ไขข้อมูล ย้ายขั้น (stage_id) หรือมอบหมาย (assigned_to) ส่งเฉพาะฟิลด์ที่ต้องการเปลี่ยน

curl -X PATCH https://propthunder.com/api/v1/contacts/3f6c…\
  -H "Authorization: Bearer pt_live_..." \
  -H "Content-Type: application/json" \
  -d '{"stage_id":"9a1e…","deal_value":4290000}'

GET/api/v1/stages

ขั้นตอนของ pipeline (ใช้หา stage_id)

GET/api/v1/listings

รายการประกาศ กรอง ?status=active|reserved|sold|rented|draft|inactive

POST/api/v1/tasks

สร้างงาน (ผูกกับลูกค้าได้ด้วย contact_id)

curl -X POST https://propthunder.com/api/v1/tasks \
  -H "Authorization: Bearer pt_live_..." \
  -H "Content-Type: application/json" \
  -d '{"title":"โทรกลับลูกค้า","due_at":"2026-11-01T10:00:00+07:00","contact_id":"3f6c…"}'

Webhooks

เพิ่ม endpoint (https เท่านั้น) และเลือกเหตุการณ์ที่ต้องการ ระบบจะ POST JSON ไปที่ URL นั้นภายในไม่กี่วินาที ถ้าตอบไม่ใช่ 2xx จะลองใหม่อัตโนมัติแบบเว้นระยะ

เหตุการณ์

POST https://your-app.example/webhooks/propthunder
PropThunder-Event: contact.created
PropThunder-Timestamp: 1793170800
PropThunder-Signature: v1=5d41402abc4b2a76b9719d911017c592...

{"event":"contact.created","created_at":"2026-10-24T09:00:00.000Z","data":{"contactId":"3f6c…","name":"สมหญิง ใจดี","source":"api"}}

ตรวจลายเซ็น

ทุก request มี header PropThunder-Timestamp และ PropThunder-Signature (v1=HMAC-SHA256 ของ "{timestamp}.{body}" ด้วย signing secret ของ endpoint) ตรวจลายเซ็นและปฏิเสธ timestamp ที่เก่ากว่า 5 นาที

import crypto from "node:crypto";

function verify(req, rawBody, secret) {
  const ts = req.headers["propthunder-timestamp"];
  const sig = req.headers["propthunder-signature"]?.replace(/^v1=/, "") ?? "";
  if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
  const expected = crypto.createHmac("sha256", secret).update(`${ts}.${rawBody}`).digest("hex");
  return sig.length === expected.length && crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
}