Skip to content

Tạo cuộc gọi

API tạo cuộc gọi tự động với kịch bản. Hỗ trợ gọi tới một số điện thoại (single call) hoặc nhiều số cùng lúc (batch call).

Luồng xác thực & tương tác

Luồng xác thực VBot Call Automation

Tạo cuộc gọi đơn lẻ

Tạo cuộc gọi tới một số điện thoại duy nhất.

POST[URL]/api/campaignCall/callConfirm/insert

Header

Tham sốGiá trị
AuthorizationBearer access_token

Body

Tham sốKiểuBắt buộcMô tả
vbot_idStringVBot ID
project_codeStringMã dự án
phoneStringSố điện thoại cần gọi (format: 09xxxxxxxx)
hotline_codeStringSố hotline (số tổng đài)
template_codeStringMã template script
max_timeIntThời gian tối đa gọi (giây), -1 = unlimited
max_waiting_timeIntThời gian chờ tối đa (giây), default: 30
external_call_idStringMã cuộc gọi từ hệ thống bên ngoài
datasObjectDữ liệu biến thay thế trong kịch bản

Ví dụ request

json
{
  "vbot_id": "123",
  "project_code": "PROJ_001",
  "phone": "0912345678",
  "hotline_code": "0812345678",
  "template_code": "CONFIRM_ORDER",
  "max_time": -1,
  "max_waiting_time": 30,
  "external_call_id": "EXT_CALL_001",
  "datas": {
    "customer_name": "Nguyễn Văn A",
    "order_id": "ORD_12345"
  }
}

Response

Tham sốKiểuMô tả
statusIntMã trạng thái (1: Thành công, 0: Thất bại)
messageStringThông tin
dataObjectThông tin cuộc gọi

Ví dụ response

json
{
  "status": 1,
  "message": "Cuộc gọi được ghi nhận thành công",
  "data": {
    "call_id": "CALL_20240110_001",
    "phone": "0912345678",
    "status": "pending"
  }
}

Tạo cuộc gọi hàng loạt

Tạo cuộc gọi tới nhiều số điện thoại cùng lúc.

POST[URL]/api/campaignCall/callConfirm/insertListPhone

Header

Tham sốGiá trị
AuthorizationBearer access_token

Body

Tham sốKiểuBắt buộcMô tả
vbot_idStringVBot ID
project_codeStringMã dự án
hotline_codeStringSố hotline (số tổng đài)
template_codeStringMã template script
phoneInfosArrayDanh sách số điện thoại
phoneInfos[].phoneStringSố điện thoại
phoneInfos[].nameStringTên khách hàng
phoneInfos[].customerUidStringID khách hàng (unique)

Ví dụ request

json
{
  "vbot_id": "123",
  "project_code": "PROJ_001",
  "hotline_code": "0812345678",
  "template_code": "CONFIRM_ORDER",
  "phoneInfos": [
    {
      "phone": "0912345678",
      "name": "Nguyễn Văn A",
      "customerUid": "CUST_001"
    },
    {
      "phone": "0987654321",
      "name": "Trần Thị B",
      "customerUid": "CUST_002"
    }
  ]
}

Response

Tham sốKiểuMô tả
statusIntMã trạng thái (1: Thành công, 0: Thất bại)
messageStringThông tin
dataObjectThông tin batch call

Ví dụ response

json
{
  "status": 1,
  "message": "Batch call campaign được tạo thành công",
  "data": {
    "batch_id": "BATCH_20240110_001",
    "phone_count": 2,
    "status": "processing"
  }
}

Lấy trường tùy chỉnh trong kịch bản

Lấy danh sách các trường tùy chỉnh (custom field) được sử dụng trong một template script cụ thể.

GET[URL]/api/campaignCall/callConfirm/getCustomFieldInScript?vbot_id={vbot_id}&project_code={project_code}&template_script_code={template_script_code}

Header

Tham sốGiá trị
AuthorizationBearer access_token

Tham số

Tham sốKiểuMô tả
vbot_idStringVBotID khách hàng
project_codeStringMã nhóm
template_script_codeStringMã template kịch bản

Response

Tham sốKiểuMô tả
statusIntMã trạng thái (1: Thành công, 0: Thất bại)
errorIntMã lỗi
messageStringThông tin

Ví dụ response

json
{
  "status": 1,
  "error": 0,
  "message": "Success",
  "data": [
    {
      "id": 1,
      "cfname": "Tên khách hàng",
      "cfkey": "customer_name",
      "description": "Tên khách hàng để xưng hô",
      "cftype": "text",
      "isRequired": true
    },
    {
      "id": 2,
      "cfname": "Mã đơn hàng",
      "cfkey": "order_id",
      "description": "Mã đơn hàng cần xác nhận",
      "cftype": "text",
      "isRequired": false
    }
  ]
}