ข้ามไปยังเนื้อหา

Quickstart

หน้านี้พาทำตั้งแต่ได้ API key จนได้ผลของ call แรก

สิ่งที่ต้องเตรียม

  • API key ให้ Owner หรือ Admin คัดลอกจาก dashboard ที่ ระบบ → นักพัฒนา → API Key ดูเพิ่มที่การยืนยันตัวตน
  • Agent ที่ทีม Gowajee ตั้งค่าให้องค์กรไว้แล้ว
  • Webhook URL (ไม่บังคับ) ตั้งได้ที่ ระบบ → นักพัฒนา → Webhook URL ต้องใช้เฉพาะเมื่ออยากให้ Gowajee ส่งผลมาให้เอง
export GOWAJEE_API_KEY="gw_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
export GOWAJEE_API="https://api.voice-agent.gowajee.ai"
  1. curl "$GOWAJEE_API/api/agent/list" -H "X-API-Key: $GOWAJEE_API_KEY"
    Response (shortened)
    {
    "success": true,
    "message": "Get Agent list successfully",
    "data": [
    {
    "id": "33ea7a25-03b2-4614-a004-fa3bf9984bd1",
    "name": "Payment reminder",
    "paramsSchema": {
    "customer_name": { "type": "text", "required": true, "description": "Customer first name" },
    "amount_due": { "type": "number", "required": true }
    }
    }
    ]
    }

    จด id ของ agent ไว้ ส่วน paramsSchema คือรายการ field ที่ต้องใส่ใน agentParams ของ recipient ทุกคน

  2. curl -X POST "$GOWAJEE_API/api/campaign/create" \
    -H "X-API-Key: $GOWAJEE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "agentId": "33ea7a25-03b2-4614-a004-fa3bf9984bd1",
    "name": "October payment reminder",
    "recipients": [
    { "tel": "0812345678", "customerName": "Somchai", "agentParams": { "customer_name": "Somchai", "amount_due": 1500 } },
    { "tel": "0898765432", "customerName": "Suda", "agentParams": { "customer_name": "Suda", "amount_due": 3200 } }
    ]
    }'
    Response 201 (shortened)
    {
    "success": true,
    "message": "Campaign created successfully",
    "data": [
    { "tel": "0812345678", "customerName": "Somchai", "agentParams": { "customer_name": "Somchai", "amount_due": 1500 },
    "campaignId": "eac2489c-672c-455e-ab8c-4e0ecd18d7dc", "organizationId": "8ee40f50-58de-4ae7-a55b-6bc83291b4be" }
    ]
    }
  3. curl -X POST "$GOWAJEE_API/api/campaign/eac2489c-672c-455e-ab8c-4e0ecd18d7dc/schedule" \
    -H "X-API-Key: $GOWAJEE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "startDateTime": "2026-10-01T02:00:00.000Z",
    "timeWindows": [
    { "dayOfWeek": 1, "time": [{ "start": "09:00", "end": "12:00" }, { "start": "13:00", "end": "18:00" }] },
    { "dayOfWeek": 2, "time": [{ "start": "09:00", "end": "18:00" }] },
    { "dayOfWeek": 3, "time": [{ "start": "09:00", "end": "18:00" }] },
    { "dayOfWeek": 4, "time": [{ "start": "09:00", "end": "18:00" }] },
    { "dayOfWeek": 5, "time": [{ "start": "09:00", "end": "18:00" }] }
    ],
    "maxAttempts": 3,
    "retryInterval": 7200000
    }'

    ระบบจะเริ่มโทรวันที่ 1 ตุลาคม 2026 เวลา 09:00 ตามเวลาไทย (02:00Z) และโทรเฉพาะวันจันทร์ถึงศุกร์ในช่วงเวลาที่กำหนด ถ้า recipient ไม่รับสาย ระบบจะโทรหาได้สูงสุด 3 ครั้ง แต่ละครั้งห่างกันอย่างน้อย 2 ชั่วโมง

  4. เช็กความคืบหน้าก่อน แล้วค่อยอ่านรายการ call ทำซ้ำทุก 1–2 นาทีจนกว่า campaign จะจบ (COMPLETED, CANCELLED หรือ EXPIRED) และไม่เหลือ call ที่ยังโทรอยู่

    # Progress: how many people are in each state
    curl "$GOWAJEE_API/api/campaign/eac2489c-672c-455e-ab8c-4e0ecd18d7dc/status" -H "X-API-Key: $GOWAJEE_API_KEY"
    # Results: every call, most recently updated first (100 per page)
    curl "$GOWAJEE_API/api/campaign/eac2489c-672c-455e-ab8c-4e0ecd18d7dc/calls?page=1" -H "X-API-Key: $GOWAJEE_API_KEY"
    A finished call in /calls (shortened)
    {
    "id": "fc1c320d-d133-4d48-8118-5932d93149fd",
    "callStatus": "COMPLETED",
    "callDuration": "120.120",
    "callResult": {
    "version": "v2",
    "fixedAttr": { "callSummary": "ลูกค้ารับทราบยอดค้างชำระ และนัดชำระวันที่ 5 ตุลาคม" },
    "postCallAnalyticsResult": { "promise_to_pay": { "type": "boolean", "required": true, "value": true } }
    },
    "recipient": { "tel": "0812345678", "customerName": "Somchai", "callAttempt": 1 }
    }

    ตัวอย่างโค้ด sync แบบครบทั้ง JavaScript และ Python อยู่ในคู่มือ Polling