curl -X POST http://localhost:5000/api/send \
-H "Authorization: YOUR_DEVICE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"target": "08123456789",
"message": "Halo, ini adalah uji coba notifikasi WhatsApp dari PMU Bungah!"
}'
<?php
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'Authorization' => 'YOUR_DEVICE_TOKEN',
])->post('http://localhost:5000/api/send', [
'target' => '08123456789',
'message' => 'Halo! Ini adalah notifikasi otomatis PMU Bungah.',
]);
$result = $response->json();
if ($result['status']) {
echo "Message sent successfully!";
} else {
echo "Failed: " . $result['reason'];
}
fetch('http://localhost:5000/api/send', {
method: 'POST',
headers: {
'Authorization': 'YOUR_DEVICE_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
target: '08123456789',
message: 'Halo, ini adalah testing API Gateway WhatsApp PMU.'
})
})
.then(res => res.json())
.then(data => {
if (data.status) console.log('Message sent!');
else console.error('Failed:', data.reason);
});