Documentação
Painel de controle da API
Botões do painel
Documentação da API
GERAR QRCODE
    FAZ A CHAMADA DE UMA IMAGEM DO QRCODE EM BASE64.
    OBS. SE HOUVER UM CELULAR JÁ CONECTADO À API, O CELULAR SERÁ DESCONECTADO PARA A GERAÇÃO DA NOVA IMAGEM.

    $dadosjson="";
    $curl = curl_init();
    $endereco= http://apps.flychat.com.br:NUMERODAPORTA/getqrcode?token=$token ;
    $retorno="ERRO";
    curl_setopt_array($curl, array(
        CURLOPT_URL => $endereco,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "GET",
        CURLOPT_HTTPHEADER => array(
            "Content-Type: application/json"
        ),
    ));

    $response = curl_exec($curl);
    curl_close($curl);
    $dadosjson=json_decode($response,true);

RETORNO DA API – IMAGEM EM BASE64
{
    "accountStatus": "OK",
    "qrCode": "data:image/png;base64,iVBORw0KGg........ "
}


DESLOGAR DA API
    $dadosjson="";
    $curl = curl_init();
    $endereco= http://apps.flychat.com.br:NUMERODAPORTA/unloadapi?token=$token ;
    $retorno="ERRO";
    curl_setopt_array($curl, array(
        CURLOPT_URL => $endereco,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "GET",
        CURLOPT_HTTPHEADER => array(
            "Content-Type: application/json"
        ),
    ));

    $response = curl_exec($curl);
    curl_close($curl);
    $dadosjson=json_decode($response,true);

RETORNO DA API

{
    "accountStatus": "OK",
    "message": "unload enviado com sucesso!"
}
RESETAR A API
    $curl = curl_init();
    $endereco= http://apps.flychat.com.br:NUMERODAPORTA/restart?token=$token ;
    curl_setopt_array($curl, array(
        CURLOPT_URL => $endereco,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "GET",
    ));

    $response = curl_exec($curl);
    curl_close($curl);
RETORNO DA API
{
    "accountStatus": "OK",
    "message": "restart enviado com sucesso!"
}
VERIFICAR STATUS
$curl = curl_init();
    $endereco= http://apps.flychat.com.br:NUMERODAPORTA/statusconexao?token=$token ;
    curl_setopt_array($curl, array(
        CURLOPT_URL => $endereco,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "GET",
        CURLOPT_HTTPHEADER => array(
            "Content-Type: application/json"
        ),
    ));
    $response = curl_exec($curl);
    curl_close($curl);

RESPOSTA DA API
{"accountStatus":"OK","message":"CONNECTED","phone":"55XXXXXXXXXXX"}
ENVIAR UM CONTATO - VCARD
Enviar um contato - vcard

$telefone = "é o número do telefone para quem você deseja enviar o contato";
$numerodocontato = "o numero do contato em sua lista de contatos do whats";
$nome_do_contato = "o nome do contato que você deseja que apareça";

$data = array(
            "phone" => $telefone,
            "contatonumero" => $numerodocontato, 
            "nomecontato" => $nome_do_contato,   
        );
        $data = json_encode($data);    
        $endereco= http://apps.flychat.com.br:NUMERODAPORTA/enviarcontato?token=$token ;
        $curl = curl_init();
        curl_setopt_array($curl, array(
            CURLOPT_URL => $endereco,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 10,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS => $data,
            CURLOPT_HTTPHEADER => array(
                    "Cache-Control: no-cache",
                    "Content-Type: application/json"
                ),
        ));

        $response = curl_exec($curl);
        curl_close($curl);
		$echo $response

RESPOSTA DA API

{
    "accountStatus": "OK",
    "message": "Message sent successfully!"
}
ENVIAR MENSAGEM
    $data = array(
            "phone" => $telefone,
            "body" => $mensagem,
        );
        $data = json_encode($data);    
        $endereco= http://apps.flychat.com.br:NUMERODAPORTA/sendmessage?token=$token ;
        $curl = curl_init();
        curl_setopt_array($curl, array(
            CURLOPT_URL => $endereco,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 10,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS => $data,
            CURLOPT_HTTPHEADER => array(
                    "Cache-Control: no-cache",
                    "Content-Type: application/json"
                ),
        ));

        $response = curl_exec($curl);
        $err = curl_error($curl);
        curl_close($curl);

RESPOSTA DA API
{
    "accountStatus": "OK",
    "message": "Message sent successfully!",
    "idmessage": "true_55400000000@c.us_CGSQWJLQKCTGCQ4DYKPU"
}
ENVIAR ARQUIVO EM BASE64
    $data = array(
            "phone" => $telefone,
            "body" => $arquivoenvio, 
            "filename" => $nomearquivo,
            "caption" => $legenda,    
        );
        $data = json_encode($data);    
        $endereco= http://apps.flychat.com.br:NUMERODAPORTA/sendarqbase64?token=$token ;
        $curl = curl_init();
        curl_setopt_array($curl, array(
            CURLOPT_URL => $endereco,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 10,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS => $data,
            CURLOPT_HTTPHEADER => array(
                    "Cache-Control: no-cache",
                    "Content-Type: application/json"
                ),
        ));

        $response = curl_exec($curl);
        curl_close($curl);

RESPOSTA DA API
{"accountStatus": "OK","message": " File sent successfully!"}
{
    "accountStatus": "OK",
    "message": "File sent successfully!",
    "idmessage": "true_55400000000@c.us_CGSQWJLQKCTGCQ4DYKPU"
}
ENVIAR ARQUIVO - LINK
	
 Enviar um arquivo através de um link
** Favor se atentar se o link do arquivo possui permissão para download, se não houver permissão a aPI não fará o envio


$data = array(
            "phone" => $telefone,
            "body" => $endereço_do_arquivo, 
            "filename" => $nomearquivo,
            "caption" => $legenda,    
        );
        $data = json_encode($data);    
        $endereco= http://apps.flychat.com.br:NUMERODAPORTA/sendfile?token=$token ;
        $curl = curl_init();
        curl_setopt_array($curl, array(
            CURLOPT_URL => $endereco,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 10,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS => $data,
            CURLOPT_HTTPHEADER => array(
                    "Cache-Control: no-cache",
                    "Content-Type: application/json"
                ),
        ));

        $response = curl_exec($curl);
        curl_close($curl);
		$echo $response

RESPOSTA DA API

{
    "accountStatus": "OK",
    "message": "File sent successfully!",
    "idmessage": "true_55XXXXXXXXXXX@c.us_3EB0F96099B641AE1DE8"
}
VALIDAR SE NUMERO EXISTE NO WHATS
faz a validação se um número existe no WhatsApp
Observação, no envio de uma mensagem a API já faz esta validação automáticamente, não sendo necessária a utilização deste recurso antes do envio da mensagem

    $data = array(
            "phone" => $telefone,
        );
        $data = json_encode($data);    
        $endereco= http://apps.flychat.com.br:NUMERODAPORTA/validanumero?token=$token ;
        $curl = curl_init();
        curl_setopt_array($curl, array(
            CURLOPT_URL => $endereco,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 10,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS => $data,
            CURLOPT_HTTPHEADER => array(
                    "Cache-Control: no-cache",
                    "Content-Type: application/json"
                ),
        ));

        $response = curl_exec($curl);
        curl_close($curl);

RESPOSTA DA API

{ accountStatus: "OK", message: true, phone: "5541xxxxxx@c.us" } //ok o numero é válido, e retorna o número cadastrado no whats

OU caso erro

{
  accountStatus: "OK",
  message: "Número não existente ou bloqueado para receber mensagens",
  phone: ""
}


ENVIAR MENSAGEM PARA GRUPO
    $grupo = "55400000000-000000000";
    $mensagem = "teste API";
    
    $data = array(
            "groupid" => $grupo,
            "body" => $mensagem,    
        );
        $data = json_encode($data);    
        $endereco= http://apps.flychat.com.br:NUMERODAPORTA/sendmessagegroup?token=$token ;

        $curl = curl_init();
        curl_setopt_array($curl, array(
            CURLOPT_URL => $endereco,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 10,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS => $data,
            CURLOPT_HTTPHEADER => array(
                    "Cache-Control: no-cache",
                    "Content-Type: application/json"
                ),
        ));


        $response = curl_exec($curl);
        $err = curl_error($curl);
        curl_close($curl);

    RESPOSTA DA API:
    
        {
            "accountStatus": "OK",
            "message": "Message sent successfully!",
            "messageid": "true_5541000000-00000000@g.us_SQTKRD128G5I9XV1KEQC"
        }    
ENVIAR ARQUIVO EM BASE64 - PARA GRUPO
    $data = array(
            $grupo = "55400000000-000000000";
            "body" => "ARQUIVO EM BASE64", 
            "filename" => $nomearquivo,
            "caption" => $legenda,    
        );
        
        
        $data = json_encode($data);    
        $endereco= http://apps.flychat.com.br:NUMERODAPORTA/sendarqbase64?token=$token ;
        $curl = curl_init();
        curl_setopt_array($curl, array(
            CURLOPT_URL => $endereco,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 10,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS => $data,
            CURLOPT_HTTPHEADER => array(
                    "Cache-Control: no-cache",
                    "Content-Type: application/json"
                ),
        ));


        $response = curl_exec($curl);
        curl_close($curl);


        RESPOSTA DA API
        {
            "accountStatus": "OK",
            "message": "File sent successfully!",
            "messageid": "true_55400000000-0000000000@g.us_AAAAAAAAAAAAAAA"
        }

SELECIONAR GRUPOS

    $curl = curl_init();
    $endereco= http://apps.flychat.com.br:NUMERODAPORTA/selecionargrupos?token=$token ;
    curl_setopt_array($curl, array(
        CURLOPT_URL => $endereco,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "GET",
        CURLOPT_HTTPHEADER => array(
            "Content-Type: application/json"
        ),
    ));


    $response = curl_exec($curl);
    curl_close($curl);
    $dadosjson=json_decode($response,true);


RETORNO DA API
{
    "accountStatus": "OK",
    "message": [
        {
            "id": "55xxxxxxxx-0000000000@g.us",
            "name": "TI 💻"
        },
        {
            "id": "55xxxxxxxx-00000000@g.us",
            "name": "3ra Bancada"
        },
        {
            "id": "55xxxxxxx-00000000@g.us",
            "name": "Reunião"
        }
    ]
}
RETORNOS PARA WEBHOOK
JSON enviado pela API 

Quando uma mensagem é recebida
{
  id: 'false_554187XXXXX@c.us_3A14D02D653850E8A75D',
  body: 'Ok',
  type: 'chat',
  time: 1605701716,
  fromMe: '',
  self: 'in',
  isForwarded: '',
  from: '554187XXXXX@c.us',
  to: '55419XXXXXXX@c.us',
  isgroup: '0',
  senderName: 'Flychat',
  senderID: '55418XXXXXX@c.us',
  caption: undefined,
  quotedMsg: undefined,
  chatName: 'Flychat Sistema De Atendimento Multiusuario',
  isBusiness: true,
  isEnterprise: false,
  isMyContact: true,
  isWAContact: true,
  profilePicThumbObj: {
    eurl: '',
    id: '5541878XXXXX@c.us',
    img: '',
    imgFull: '',
    raw: null,
    tag: '1598634124'
  },
  tipomensagem: 'recebida'
}

Quando uma mensagem é enviada ou é alterado o ACK(status) de uma mensagem 
{
  id: 'true_554187XXXXX@c.us_3EB02D30F2AAF3FE085F',
  body: 'OK',
  fromMe: true,
  chatId: '5541878XXXXX@c.us',
  type: 'chat',
  time: 1605667553,
  from: '554192552355@c.us',
  to: '554187XXXXX@c.us',
  isgroup: '0',
  status: 0,   //1 - ENVIADA, 2 - ENTREGUE, 3 - LIDA
  tipomensagem: 'enviada ou alteracao do status(ack) das mensagens'
}
Sair