API - API DO ZAP (whatsmeow PR...
Botões e Mais Botões
10 min
\<?php $curl = curl init(); curl setopt array($curl, array( curlopt url => 'https //{backend url}/api/messages/whatsmeow/sendbuttonspro', 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 =>'{ "openticket" 0, "body" \[ { "phone" "5511989091838", "title" "escolha uma opção", "body" "clique em uma das opções abaixo ", "footer" "teste de quick reply", "buttons" \[ { "type" "quick reply", "text" "sim", "id" "opcao sim" } ] } ] }', curlopt httpheader => array( 'content type application/json', 'authorization bearer seutokenaqui' //token cadastrado na conexão ), )); $response = curl exec($curl); curl close($curl); echo $response; exemplos de payload 1\ botão quick reply { "phone" "5511989091838", "title" "escolha uma opção", "body" "clique em uma das opções abaixo ", "footer" "teste de quick reply", "buttons" \[ { "type" "quick reply", "text" "sim", "id" "opcao sim" } ] } 2\ botão url { "phone" "5511989091838", "title" "veja nosso site", "body" "clique para acessar ", "footer" "link oficial", "buttons" \[ { "type" "url", "text" "acesse o site", "url" "https //www google com" } ] } 3\ botão call { "phone" "5511989091838", "title" "precisa de atendimento?", "body" "clique para ligar ", "footer" "central de atendimento", "buttons" \[ { "type" "call", "text" "ligar agora", "phonenumber" "+5511987654321" } ] } 4\ botão copy { "phone" "5511989091838", "title" "seu cupom exclusivo", "body" "use o cupom abaixo ", "footer" "oferta válida até hoje", "buttons" \[ { "type" "copy", "text" "copiar cupom", "code" "meu cupom 123" } ] } 5\ botão review & pay (pix c/ instruções customizadas)/ { "phone" "5511989091838", "title" "cobrança personalizada", "body" "clique para pagar após revisar os detalhes ", "footer" "pagamento inteligente", "buttons" \[ { "type" "review and pay", "text" "revisar e pagar", "pixkey" "rafael\@pix com br", "pixtype" "email", "instructions" "confira os detalhes do pedido antes de pagar " } ] } 6\ pagar com pix { "phone" "5511989091838", "title" "pagamento com pix", "body" "clique no botão para pagar com pix!", "footer" "pedido #123", "buttons" \[ { "type" "pix", "text" "pagar com pix", "pixkey" "123e4567 e12b 12d1 a456 426614174000", "pixtype" "evp" } ] } 7\ múltiplos botões no mesmo payload { "phone" "5511989091838", "title" "o que deseja fazer?", "body" "escolha uma opção ", "footer" "multi botão", "buttons" \[ { "type" "url", "text" "site", "url" "https //openai com" }, { "type" "call", "text" "ligar", "phonenumber" "+551112345678" }, { "type" "copy", "text" "copiar pix", "code" "123e4567 e12b 12d1 a456 426614174000" } ] }