Dokumentasi API
API Notifikasi Bisnis
API notifikasi & gateway pesan Saungwa untuk integrasi sistem: satu endpoint POST /api/create-message untuk pesan teks, pesan dengan file, dan pesan template.
PHP
Create New Message
Text Message Only
PHP
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://app.saungwa.com/api/create-message',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array(
'appkey' => 'e98095ab-363d-47a4-b3b6-af99d68ef2b8',
'authkey' => 'jH7UfjEsjiw86eF7fTjZuQs62ZIwEqtHL4qjCR6mY6sE36fmyT',
'to' => 'RECEIVER_NUMBER',
'message' => 'Example message',
'sandbox' => 'false'
),
));
$response = curl_exec($curl);
curl_close($curl);Pesan Teks dengan file
PHP
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://app.saungwa.com/api/create-message',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array(
'appkey' => 'e98095ab-363d-47a4-b3b6-af99d68ef2b8',
'authkey' => 'jH7UfjEsjiw86eF7fTjZuQs62ZIwEqtHL4qjCR6mY6sE36fmyT',
'to' => 'RECEIVER_NUMBER',
'message' => 'Example message',
'file' => 'https://www.africau.edu/images/default/sample.pdf',
'sandbox' => 'false'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;Template Message Only
PHP
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://app.saungwa.com/api/create-message',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array(
'appkey' => 'e98095ab-363d-47a4-b3b6-af99d68ef2b8',
'authkey' => 'jH7UfjEsjiw86eF7fTjZuQs62ZIwEqtHL4qjCR6mY6sE36fmyT',
'to' => 'RECEIVER_NUMBER',
'template_id' => 'TEMPLATE_ID',
'variables' => array(
'{variableKey1}' => 'Jhone',
'{variableKey2}' => 'replaceable value'
)
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;CURL
Create New Message
Text Message Only
cURL
curl --location --request POST 'https://app.saungwa.com/api/create-message' \ --form 'appkey="e98095ab-363d-47a4-b3b6-af99d68ef2b8"' \ --form 'authkey="jH7UfjEsjiw86eF7fTjZuQs62ZIwEqtHL4qjCR6mY6sE36fmyT"' \ --form 'to="RECEIVER_NUMBER"' \ --form 'message="Example message"'
Text Message with file
cURL
curl --location --request POST 'https://app.saungwa.com/api/create-message' \ --form 'appkey="e98095ab-363d-47a4-b3b6-af99d68ef2b8"' \ --form 'authkey="jH7UfjEsjiw86eF7fTjZuQs62ZIwEqtHL4qjCR6mY6sE36fmyT"' \ --form 'to="RECEIVER_NUMBER"' \ --form 'message="Example message"' \ --form 'file="https://www.africau.edu/images/default/sample.pdf"'
Template Only
cURL
curl --location --request POST 'https://app.saungwa.com/api/create-message' \
--form 'appkey="e98095ab-363d-47a4-b3b6-af99d68ef2b8"' \
--form 'authkey="jH7UfjEsjiw86eF7fTjZuQs62ZIwEqtHL4qjCR6mY6sE36fmyT"' \
--form 'to="RECEIVER_NUMBER"' \
--form 'template_id="TEMPLATE_ID"' \
--form 'variables[{variableKey1}]="jhone"' \
--form 'variables[{variableKey2}]="replaceable value"'Successful Json Callback
JSON
{
"message_status": "Success",
"data": {
"from": "SENDER_NUMBER",
"to": "RECEIVER_NUMBER",
"status_code": 200
}
}Parameter
| S/N | Value | Type | Required | Description |
|---|---|---|---|---|
| 1. | appkey | string | Yes | Used to authorize a transaction for the app |
| 2. | authkey | string | Yes | Used to authorize a transaction for the is valid user |
| 3. | to | number | Yes | Who will receive the message the Whatsapp number should be full number with country code |
| 4. | template_id | string | No | Used to authorize a transaction for the template |
| 5. | message | string | No | The transactional message max:1000 words |
| 6. | file | string | No | file extension type should be in jpg,jpeg,png,webp,pdf,docx,xlsx,csv,txt |
| 7. | variables | Array | No | the first value you list replaces the {1} variable in the template message and the second value you list replaces the {2} variable |
Mulai broadcast yang rapi, terjadwal, dan patuh kebijakan
Daftar sekarang, hubungkan perangkat, buat template pertama Anda, dan kirim ke pelanggan yang sudah opt-in โ semua dari satu dashboard.
Coba Sekarang