Implement WhatsApp API integration for message sending and update library version to 2.7

This commit is contained in:
jhartworks
2025-10-15 14:44:50 +02:00
parent 3ac07a37ab
commit adc6451c72
2 changed files with 36 additions and 2 deletions
+35 -1
View File
@@ -469,7 +469,41 @@ class MonitoringServer extends IPSModule {
if ($numbersWhatsapp != ""){ if ($numbersWhatsapp != ""){
$numbers = str_getcsv($numbersWhatsapp); $numbers = str_getcsv($numbersWhatsapp);
foreach ($numbers as $number){ foreach ($numbers as $number){
WBM_SendMessageEx($idWhatsapp,$number,$paramvals); // WBM_SendMessageEx($idWhatsapp,$number,$paramvals);
$url = 'https://whatsappapi.se-inno.de'; // 👈 API-URL hier eintragen
$data = [
'api_key' => $idWhatsapp,
'number' => $number,
'message' => $smname,
'template' => 'stoerung',
'pn' => $art
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
// Optional: SSL-Validierung ausschalten (nur zu Testzwecken!)
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
header('Content-Type: text/plain');
echo "HTTP-Code: $httpcode\n";
if ($error) {
echo "cURL Error: $error\n";
} else {
echo "Response:\n$response\n";
}
// IPS_LogMessage ("Send Whatsapp " .$projectnumber , "Whatsapp an folgende Nummer gesendet: ". $number ); // IPS_LogMessage ("Send Whatsapp " .$projectnumber , "Whatsapp an folgende Nummer gesendet: ". $number );
} }
$whatsapped = 1; $whatsapped = 1;
+1 -1
View File
@@ -7,7 +7,7 @@
"version": "6.0", "version": "6.0",
"date": 1491343200 "date": 1491343200
}, },
"version": "2.6", "version": "2.7",
"build": 1, "build": 1,
"date": 0 "date": 0
} }