<?php
$urlBot = "https://caracolplayer.sigma.st/api/chatbot/b8K1xZ6DvG/z2BDvoWrkj";

$mensagemJson = json_encode([
    "receiveMessageAppId" => "com.whatsapp",
    "receiveMessagePattern" => ["*"],
    "senderName" => "API DE TESTE",
    "groupName" => "",
    "senderMesage" => "teste iptv",
    "senderMessage" => "teste iptv",
    "messageDateTime" => time(),
    "isMessageFromGroup" => false
]);

$ch = curl_init($urlBot);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $mensagemJson);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Content-Length: ' . strlen($mensagemJson)
]);

$response = curl_exec($ch);
$erro = curl_error($ch);
curl_close($ch);

echo "<h3>✅ RESPOSTA BRUTA:</h3><pre>";
var_dump($response);
echo "</pre>";

echo "<h3>✅ JSON DECODIFICADO:</h3><pre>";
var_dump(json_decode($response, true));
echo "</pre>";

echo "<h3>✅ ERRO DO CURL (se houver):</h3><pre>";
var_dump($erro);
echo "</pre>";
