Enviar Carrossel
1 min
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://{BACKEND_URL}/api/messages/whatsmeow/sendCarousel',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"number": "555192914354",
"caption": "TESTE",
"footer": "Testando",
"openTicket": "0",
"queueId": 0,
"cards": [
{
"title": "Produto 1",
"body": "Descrição do produto",
"footer": "R$ 99,90",
"imageUrl": "https://picsum.photos/400/400",
"buttons": [
{"id": "comprar_1", "text": "Comprar"},
{"id": "info_1", "text": "Mais info"}
]
},
{
"title": "Produto 2",
"body": "Outro produto incrível",
"footer": "R$ 149,90",
"imageUrl": "https://picsum.photos/401/401",
"buttons": [
{"id": "comprar_2", "text": "Comprar"}
]
}
]
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer seutokenaqui' //Token cadastrado na conexão
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;