إرسال تلقائي بأجهزة المستخدم المتصلة
يبعت المستخدم Auth Key في الهيدر فقط، والسيستم يختار جهاز متصل بالتساوي بين الأجهزة المتاحة.
authkey: YOUR_AUTH_KEY
curl --location --request POST 'https://waapi.octopusteam.net/api/send-message' --header 'authkey: YOUR_AUTH_KEY' --header 'Accept: application/json' --header 'Content-Type: application/json' --data-raw '{"to":"2010XXXXXXXX","type":"text","message":"Hello from WAAPI auto routing","custom_data":{"order_id":"ORD-1001"}}'
const response = await fetch("https://waapi.octopusteam.net/api/send-message", {
method: "POST",
headers: {
"authkey": "YOUR_AUTH_KEY",
"Accept": "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
"to": "2010XXXXXXXX",
"type": "text",
"message": "Hello from WAAPI auto routing",
"custom_data": {
"order_id": "ORD-1001"
}
})
});
const data = await response.json();
console.log(data);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://waapi.octopusteam.net/api/send-message',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array (
0 => 'authkey: YOUR_AUTH_KEY',
1 => 'Accept: application/json',
2 => 'Content-Type: application/json',
),
CURLOPT_POSTFIELDS => json_encode(array (
'to' => '2010XXXXXXXX',
'type' => 'text',
'message' => 'Hello from WAAPI auto routing',
'custom_data' =>
array (
'order_id' => 'ORD-1001',
),
)),
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
$response = Http::withHeaders(array (
'authkey' => 'YOUR_AUTH_KEY',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
))
->post('https://waapi.octopusteam.net/api/send-message', array (
'to' => '2010XXXXXXXX',
'type' => 'text',
'message' => 'Hello from WAAPI auto routing',
'custom_data' =>
array (
'order_id' => 'ORD-1001',
),
));
$data = $response->json();
import requests
response = requests.request(
"POST",
"https://waapi.octopusteam.net/api/send-message",
headers={
"authkey": "YOUR_AUTH_KEY",
"Accept": "application/json",
"Content-Type": "application/json"
},
json={
"to": "2010XXXXXXXX",
"type": "text",
"message": "Hello from WAAPI auto routing",
"custom_data": {
"order_id": "ORD-1001"
}
},
)
print(response.status_code)
print(response.text)