Acesse guias, suporte e melhores práticas para aproveitar ao máximo o Zapisp.
[ARQUIVADO] Como utilizar o Gateway para envios

1 - Enviando texto



  • Jquery


var settings = {   

url:"https://zapisp.com.br/api/whatsapp/generic/v1/text",

method: "POST", // ou GET

data:

{

apiToken: "token_da_instancia",

telefone: "NUMERO_DO_TELEFONE",

mensagem: "mensagem"

}

}

$.ajax(settings).done(function (response){

console.log(response);

});


  • PHP


$mensagem = 'Meu primeiro teste com a API do zapisp!';   

$telefone = 'NUMERO_DO_TELEFONE';

$apiToken = 'token_da_instancia';

$api = "https://zapisp.com.br/api/whatsapp/generic/v1/text";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $api);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, [

'apiToken' => $apiToken,

'telefone' => $telefone,

'mensagem' => $mensagem

]);

$response = curl_exec($ch);

curl_close($ch);

print_r($response);



2 - Enviando PDF



  • PHP



$telefone = 'NUMERO_DO_TELEFONE';

$title = 'Exemplo';

$pdf = 'https://expoforest.com.br/wp-content/uploads/2017/05/exemplo.pdf';

$apiToken = 'token_da_instancia';

$api = "https://zapisp.com.br/api/whatsapp/generic/v1/pdf";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $api);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, [

'apiToken' => $apiToken,

'telefone' => $telefone,

'title' => $title,

'pdf' => $pdf

]);

$response = curl_exec($ch);

curl_close($ch);

print_r($response);


  • Jquery


var settings = {   

url: "https://zapisp.com.br/api/whatsapp/generic/v1/pdf",

method: "POST", // ou GET

data:

{

apiToken: "token_da_instancia",

telefone: NUMERO_DO_TELEFONE",

pdf: "https://expoforest.com.br/wp-content/uploads/2017/05/exemplo.pdf",

title: "Exemplo"

}

}

$.ajax(settings).done(function (response) {

console.log(response);

});


3 - Envio de imagem


  • PHP


$telefone = 'NUMERO_DO_TELEFONE';   

$msg = 'Essa é uma imagem';

$img = 'https://zapisp.com.br/public/api.png';

$apiToken = 'token_da_instancia';

$api = "https://zapisp.com.br/api/whatsapp/generic/v1/img";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $api);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, [

'apiToken' => $apiToken,

'telefone' => $telefone,

'msg' => $msg,

'img' => $img

]);

$response = curl_exec($ch);

curl_close($ch);

print_r($response);


  • Jquery



var settings = {

url: "https://zapisp.com.br/api/whatsapp/generic/v1/img",

method: "POST", // ou GET

data:

{

apiToken: "token_da_instancia",

telefone: "NUMERO_DO_TELEFONE",

img: "https://zapisp.com.br/public/api.png",

msg: "Essa é uma imagem"

}

}

$.ajax(settings).done(function (response) {

console.log(response);

});


Nunca divulgue ou compartilhe esta informação com terceiros. Isto possibilitará que mensagens sejam enviadas em nome da sua empresa!

Esta resposta resolveu sua dúvida?