AntBOT API
Tích hợp và sử dụng từ ứng dụng thứ 3
Mục đích
Cho phép sử dụng Alice từ ứng dụng thứ 3. Yêu cầu bắc buộc đã đăng ký và trial alice từ onboarding antbuddy.
Cho phép chạy chiến dịch từ ứng dụng thứ 3.
Tạo alarm cho 1 liên hệ (appointment)
API chi tiết
Tất cả API request tới hệ thống Alice:
Thông qua tên miền
https://alice.antbuddy.com/rest-apiAuthorize header bắt buộc:
Authorization: Bearer {access_token}Get AccessToken
Endpoint: /get-token/
Method: POST
Body: {
"username": "username",
"password": "password"
}
Description:
Username: Tên hoặc email đã tạo bên antbuddy
Password: Mật khẩuChiến dịch
Kiểm tra những chiến dịch đang có
Survey Template: /rest-api/campaigns/
Method: GET
Params: {
"name": "NESHB"
"phonebook": "732"
"status" "1"
}
Description:
- name : Tìm kiếm theo tên
- phonebook : Tìm theo danh bạ
- status : Tìm theo trạng thái của chiến dịch
1 : Đã bắt đầu
2 : Đang đợi
3 : Đang ngừng
4 : Đã kết thúc
5 : Đã hoàn thànhCấu hình callflow cho chiến dịch
Survey
Tạo mẫu khảo sát (Survey Template)
Create survey: /rest-api/survey-template/
Method: POST
Body: {
"name": "Tên survey",
"tts_language": "vi",
"description": "anything"
}
Description:
- name : Tên mẫu khảo sát
- tts_language : Ngôn ngữ của mẫu khảo sát
vi : Tiếng việt
en : Tiếng anh
- description : Mô tả của mẫu khảo sátKiểm tra mẫu khảo sát có sẵn
Survey Template: /rest-api/survey-template/
Method: GET
Params: {
"search": "template name"
"description": "description"
"is_onboarding" "true"
"user": "203"
}
Description:
- search : Tìm kiếm theo tên
- description : Tìm theo mô tả
- is_onboarding :
- user : Tìm theo id người dùngTạo Section template
Create section: /rest-api/section-template/
Method: POST
Body: {
"type": 1,
"survey": ID of survey,
"question": String (tên section),
"script": Text (nội dụng ivr)
}
Update section:
Endpoint: /rest-api//section-template/{id}/
Method: PUT
Body {
"script" : "Vui lòng đợi trong giây lát."
}Phonebook & contact
Kiểm tra phonebook hiện có
Phonebook : /rest-api/phonebook/{id} (Tìm theo id)
Method: GET
Params: {
"search": "name"
}
Description:
- search : Tìm theo tên danh bạKiểm tra contact hiện có
Contact : /rest-api/contact/{id} (Tìm theo id)
Method: GET
Params: {
"phonebook" : "732"
"search" : "0934523423"
}
Description:
- phonebook : Tìm theo id của phonebook
- search : Tìm theo số điện thoại hoặc tên Tạo Phonebook
Create phonebook : /rest-api/phonebook/
Method: POST
Body: {
"name": "name",
"description": "rest phonebook" (option)
}
Description:
- name : Tên danh bạ
- description : Mô tảCập nhập Phonebook
Update phonebook: /rest-api/phonebook/{id}/
Method: PUT
Body: {
"name": “changed name”,
"description": “updated descrption"
}
Description:
- name : Thay đổi tên
- description : Thay đổi mô tảTạo Contact
- Create single contact
Create: /rest-api/contact/
Method: POST
Body: {
"phonebook": {phonebook_id} (required),
"contact": "0934890883" (required),
"email": "[email protected]" (optional),
"last_name": "Huynh" (optional),
"first_name": "Linh" (optional),
"description": "khách hàng ABC" (optional),
"status": 1 or 0 (1: active, 0: inactivate) (required),
"additional_vars": "{\"params_1\":\"123456\",\"params_2\":\"123456\"}" (optional)
}Cập nhập contact dựa trên id
Update: /rest-api/contact/{id}/
Method: PUT
Body: {
"contact": "0934890884",
"status": 1,
"country": "VN",
"first_name": "A",
"last_name": "B"
}- Create multiple contact (endpoint: /rest-api/bulkcontact/)
EndPoint: /rest-api/bulkcontact/
Method: POST
Body: {
"phonebook": 293,
"contacts": [
{
"contact": "0934890883",
"email": "[email protected]",
"last_name": "Huynh",
"first_name": "Linh",
"status": 1
},
{
"contact": "0934890881",
"email": "[email protected]",
"last_name": "Huynh",
"first_name": "Linh",
"status": 1
}
]
}Tạo chiến dịch thoại
Kiểm tra gateway hiện có
Gateway List (Endpoint: /rest-api/gateway/)
Method: GET
Response: {
"results": [
{
"id": 23,
"name": "AliceDevGateway",
"status": 1,
"description": "AliceDevGateway",
"addprefix": "",
"removeprefix": "",
"gateways": "sofia/gateway/AliceDevGateway/",
"subdomain": "company",
"gateway_codecs": "",
"gateway_timeouts": "10",
"gateway_retries": "",
"originate_dial_string": "",
"secondused": null,
"created_date": "2019-12-26T04:17:12.673711Z",
"updated_date": "2020-01-14T03:12:27.079710Z",
"addparameter": "",
"count_call": 0,
"count_in_use": null,
"maximum_call": null,
"is_trial": true,
"failover": null
}
]
}Tạo chiến dịch
Endpoint: /rest-api/campaigns/
Method: POST
Body Example:
{
"name": "rest-api-cp-2"
"description": "rest api for campaign",
"callerid": "lh",
"phonebook": [
293
],
"aleg_gateway": 23,
"object_id": 351,
"frequency": 10,
"startingdate": "2020-02-11T02:36:39.045000Z",
"expirationdate": "2020-02-12T02:36:39.045000Z",
"daily_start_time": "08:00:00",
"daily_stop_time": "21:00:00"
}
Description:
- name: required,
- description: rest api for campaign (option),
- callerid: caller name when callout (option),
- phonebook: phone book IDs list (required),
- aleg_gateway:gateway dialout (required),
- object_id: survey template application (required),
- frequency: call per minute (required),
- startingdate: Starting date campaign (required),
- expirationdate: Stopped date campaign (required),
- daily_start_time: dialy time (required),
- daily_stop_time: dialy ending time(required)Cập nhật chiến dịch thoại
Endpoint: /rest-api/campaigns/{id}/
Method: PUT
Body:
{
"name": "rest-api-cp-2",
"description": "rest api for campaign",
"callerid": "rest_api",
"phonebook": [
293
],
"frequency": 3,
"startingdate": "2020-02-11T02:36:39.045000Z",
"expirationdate": "2020-02-12T02:36:39.045000Z",
"daily_start_time": "09:00:00",
"daily_stop_time": "18:00:00"
}Thay đổi trạng thái chiến dịch thoại
Endpoint: /rest-api/campaigns/{id}/status/
Method: POST
Body: {
"status": 1,
}
Description:
START = 1
PAUSE = 2
ABORT = 3
END = 4Xóa chiến dịch thoại
Endpoint: /rest-api/campaigns/{id}
Method: DELETEAppointment
Survey List
Kiểm tra danh sách các survey
Endpoint: /rest-api/survey-list/
Method: GET
Params: {
"search" : "test"
"tts_language" : "vi"
"description" : "Test"
"campaign" : 1243
}
Description:
- search : Tìm theo tên
- tts_language : Tìm theo ngôn ngữ
vi : Tiếng việt
en : Tiếng anh
- description : Tìm theo mô tả
- campaign : Tìm theo id của chiến dịchDNC (Do Not Call)
Kiểm tra danh sách DNC
Endpoint: /rest-api/dnc-list/
Method: GETKiểm tra DNC Contact
Endpoint: /rest-api/dnc-contact/
Method: GETThêm vào DNC list
Endpoint: /rest-api/dnc-list/
Method: POST
Body: {
"name" : "name dnc",
"description" : "test"
}
Description:
- name : Tên DNC
- description : Mô tảThêm vào DNC Contact
Endpoint: /rest-api/dnc-contact/
Method: POST
Body: {
"phone_number" : "0324324343",
"dnc" : "343"
}
Description:
- phone_number : Số điện thoại
- dnc : ID của DNC listReport
Kiểm tra báo cáo
Endpoint: /rest-api/cdr/
Method: GET
Params: {
"callid" : "res232-fsf3-sfdsf"
"callerid" : "admin"
"phone_number" : 094343434
"from_date" : 2023-04-06T10:52:56.162517Z
"to_date" : 2023-03-28T08:05:07.495988Z
"duration" : 34
"billsec" : 3
"disposition" : FAILED
"hangup_cause" : UNALLOCATED_NUMBER
"sip_term_status" : 404
"sip_term_cause" : 2
"endpoint_disposition" : ANSWER
"campaign" : 23
"alarm" : false
"otp" : true
}
Description:
- callid : Id cuộc gọi
- callerid : Id người gọi
- phone_number : Số điện thoại
- from_date : Thời điểm bắt đầu
- to_date : Thời điểm kết thúc
- duration : Thời lượng cuộc gọi
- billsec :
- disposition :
- hangup_cause : Lí do ngừng cuộc gọi
- sip_term_status :
- sip_term_cause :
- endpoint_disposition :
- campaign : Id của chiến dịch
- alarm : Những cuộc gọi nhắc lịch
true : Những cuộc gọi nhắc lịch
false : Những cuộc gọi không nhắc lịch
- otp : Những cuộc gọi OTP
true : Những cuộc gọi OTP
false : Những cuộc gọi không phải OTPSubcribers
Xem thành viên chiến dịch
Get subcribers : /rest-api/subscriber-list/
Method: GET
Params: {
"campaign" : 2323
"contact" : 094344334
"status" : 2
"duration" : 43
"billsec" : 23
}
Description:
- campaign : Id của chiến dịch
- contact : Số điện thoại
- status : trạng thái
- duration : Thời lượng cuộc gọi
- billsec : Calendar
Thiết lập lịch
Endpoint: /rest-api/calendar-setting/
Method: POST
Body: {
"label": "rest-api-cp-2",
"callerid": "mantest_calendarsettings",
"caller_name": "",
"call_timeout": 60,
"survey": 953,
"aleg_gateway": 23
}
Description:
- label: tên (required),
- callerid: caller hiển thị (option),
- caller_name: tên người gọi (option),
- call_timeout: thời gian cuộc gọi timeout bằng giây (required),
- survey": id của khảo sát (required), get from Survey List API
- aleg_gateway: cổng nối gọi ra (required),
Get from Gateway List APICalendar User
Endpoint: /rest-api/calendar-user/
Method: POST
Body:
{
"username": "cal-rest-user-resp2",
"password": "12345678" - required,
"calendar_setting": 4 - required
}
Description:
- username: user login (required)
- calendar_setting: Calendar setting,
GET from calendar-setting APITạo lịch
Endpoint: /rest-api/calendar/
Method: POST
Body: {
"name": "linh-calendar-rest",
"user": 5 - required
}
Description:
- name: required
- user: Calendar User List,
Get from calendar-user APITạo sự kiện
Endpoint: /rest-api/event/
Method: POST
Body: {
"title": "today-linhhv",
"description": "",
"start": "2020-02-15T09:30:39.177000Z",
"end": "2020-02-15T10:13:39.177000Z",
"creator": 115,
"calendar": 7
}
Description:
- title: Tên sự kiện (required)
- start: Thời gian bắt đầu (required)
- end: Thời gian kết thúc (required)
- creator: calendar user được gắn vào,
được lấy từ calendar-user API
- calendar: Lịch gắn vô sự kiện,
được lấy từ calendar APITạo Alarm
Endpoint: /rest-api/alarm/
Method: POST
Body:
{
"alarm_phonenumber": "0934890883",
"date_start_notice": "2020-02-12T02:49:33.572Z",
"phonenumber_transfer": "",
"event": 8
}
Description:
- alarm_phonenumber: call to number (required),
- date_start_notice: starting date alarm - (option- default current time),
- phonenumber_transfer: phone to transfer (option),
- event: related event (required), event list get from event API, method GetLast updated