POST
https://api.alatwa.com/ai/whitelist/add/{protected_code}
Headers
Name Type Description
Authorization
string
required
API Key akun Alat WA Anda
Content-Type
string
required
application/json
Path Parameters
Name Type Description
protected_code
string
required
Protected code (ID publik) dari AI template. Didapat dari endpoint List AI Settings.
Body Parameters
Name Type Description
phone
string
required
Nomor WhatsApp yang akan di-whitelist
name
string
optional
Nama customer (maks 100 karakter)
subdistrict
string
optional
Kelurahan/desa (maks 100 karakter)
district
string
optional
Kecamatan (maks 100 karakter)
latitude
float
optional
Latitude lokasi customer
longitude
float
optional
Longitude lokasi customer
metadata
object
optional
Object key-value tambahan (mis. { "email": "...", "kode_pelanggan": "..." })
Code Examples
cURL
PHP
Node.js
Python
curl -X POST https://api.alatwa.com/ai/whitelist/add/YOUR_TEMPLATE_CODE \
-H "
Authorization :
YOUR_API_KEY " \
-H "
Content-Type :
application/json " \
-d '
{
"phone": "628111111111",
"name": "John Doe",
"subdistrict": "Menteng",
"district": "Menteng",
"latitude": -6.1944,
"longitude": 106.8229,
"metadata": {
"email": "[email protected] "
}
} '
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.alatwa.com/ai/whitelist/add/YOUR_TEMPLATE_CODE ');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization : YOUR_API_KEY ',
'Content-Type : application/json '
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
const response =
await fetch ('
https://api.alatwa.com/ai/whitelist/add/YOUR_TEMPLATE_CODE ', {
method : '
POST ',
headers : {
'
Authorization ': '
YOUR_API_KEY ',
'
Content-Type ': '
application/json '
},
body : JSON.
stringify (
{
"phone": "628111111111",
"name": "John Doe",
"subdistrict": "Menteng",
"district": "Menteng",
"latitude": -6.1944,
"longitude": 106.8229,
"metadata": {
"email": "[email protected] "
}
} )
});
import requests
response = requests.
post (
'
https://api.alatwa.com/ai/whitelist/add/YOUR_TEMPLATE_CODE ',
headers ={
'
Authorization ': '
YOUR_API_KEY ',
'
Content-Type ': '
application/json '
},
json =
{
"phone": "628111111111",
"name": "John Doe",
"subdistrict": "Menteng",
"district": "Menteng",
"latitude": -6.1944,
"longitude": 106.8229,
"metadata": {
"email": "[email protected] "
}
}
)
Response
200 Success
{
"status ": "ok ",
"message ": "Whitelist added ",
"action ": "created "
}
Response Fields
Field Type Description
status
string
"ok" atau "error"
message
string
"Whitelist added" (baru) atau "Whitelist updated" (upsert)
action
string
"created" kalau insert baru, "updated" kalau upsert nomor existing