$data = json_decode(file_get_contents("php://input"), true); $stmt = $conn->prepare(" INSERT INTO whatsapp_messages (chat_id, number_id, sender, message, from_me, type) VALUES (?, ?, ?, ?, ?, ?) "); $stmt->execute([ $data['chat_id'], $data['number_id'], $data['sender'], $data['message'], $data['from_me'], $data['type'] ?? 'text' ]); echo json_encode([ 'success' => true, 'message_id' => $conn->lastInsertId() ]);