<%= it.Breadcrumb(it.title, [ { label: "Home", href: "/" }, { label: "Import Data", href: "/import-data/lead" }, { label: "Lead", href: "/import-data/lead" }, { label: "คู่มือ API", current: true }, ]) %>

คู่มือ API นำเข้า Lead

นำเข้าข้อมูล Lead ได้ 2 วิธี: อัปโหลดไฟล์ (CSV/XLSX) และ ส่งผ่าน API (JSON)

1. นำเข้าด้วยไฟล์ (CSV / XLSX)

POST /api/v1/leads/import/file — Content-Type: multipart/form-data, Authorization: Bearer <JWT>

Form fields: file (ไฟล์), property_id, lead_source

2. ค่า lead_source ที่รองรับ
3. โครงสร้างไฟล์ CSV/XLSX

แถวแรก = Header. คอลัมน์: name / full_name, email, phone, company, title, notes. แต่ละแถวต้องมี name หรือ email อย่างน้อย 1 ฟิลด์

4. นำเข้าด้วย API (JSON)

POST /api/v1/leads/import — Content-Type: application/json

{
  "property_id": "prop-001",
  "lead_source": "facebook_leadgen",
  "leads": [
    { "name": "สมชาย ใจดี", "email": "somchai@example.com", "phone": "0812345678" }
  ]
}
5. ดาวน์โหลดไฟล์ตัวอย่าง

GET /api/v1/leads/import/example/csvGET /api/v1/leads/import/example/xlsx (ต้องส่ง Authorization)

← กลับไปหน้านำเข้า Lead