This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | TUTORIAL SIMPLES NGINX | |
| 1º - vai em... | |
| cd /etc/nginx/sites-available/ | |
| 2º - cria o arquivo | |
| nano proxy_myzap | |
| 3º - cola o conteudo do link | |
| https://gist.github.com/jhowbhz/689322bedd2e2487b97aa57ffe0a732d | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /****************************************************************************************************************/ | |
| /* Antes de utilizar esses codigos, inicie a sessão em https://whatsapp-v2.apibrasil.com.br/start */ | |
| /****************************************************************************************************************/ | |
| async function getProfilePic(session, sessionkey, number) { | |
| let server = `https://whatsapp-v2.apibrasil.com.br/`; // servidor do whatsapp você pode obter em apigratis.com.br | |
| let body = JSON.stringify({ | |
| "session": `${session}`, // session do whatsapp, você deve ir até o endpoint `https://whatsapp-v2.apibrasil.com.br/start` para ler o qr-code e obter a session | |
| "number": `${number?.replace(/[^0-9]/g,'')}`, // numeero limpo | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /****************************************************************************************************************/ | |
| /* Antes de utilizar esses codigos, inicie a sessão em https://whatsapp-v2.apibrasil.com.br/start */ | |
| /****************************************************************************************************************/ | |
| async function sendText(session, sessionkey, number, text) { | |
| let server = `https://whatsapp-v2.apibrasil.com.br/`; // servidor do whatsapp você pode obter em apigratis.com.br | |
| let body = JSON.stringify({ | |
| "session": `${session}`, // session do whatsapp, você deve ir até o endpoint `https://whatsapp-v2.apibrasil.com.br/start` para ler o qr-code e obter a session | |
| "number": `${number?.replace(/[^0-9]/g,'')}`, // numeero limpo | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | pm2 --cron | |
| pm2 start aplicacao.js --name nome_aplicacao --cron "*/15 * * *" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <!DOCTYPE html> | |
| <!-- Antes de utilizar esses codigos, verifique as informações em https://apibrasil.com.br --> | |
| <html lang="pt_BR"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Chat Demo MyZAP / apigratis.com.br</title> | |
| </head> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /****************************************************************************************************************/ | |
| /* Antes de utilizar esses codigos, inicie a sessão em https://whatsapp-v2.apibrasil.com.br/start */ | |
| /****************************************************************************************************************/ | |
| async function sendFile(session, sessionkey, number, path, name = `fileName`, caption = `captionFile`) { | |
| let server = `https://whatsapp-v2.apibrasil.com.br/`; // servidor do whatsapp você pode obter em apigratis.com.br | |
| let body = JSON.stringify({ | |
| "session": `${session}`, // session do whatsapp, você deve ir até o endpoint `https://whatsapp-v2.apibrasil.com.br/start` para ler o qr-code e obter a session | |
| "number": `${number?.replace(/[^0-9]/g,'')}`, // numeero limpo | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| /****************************************************************************************************************/ | |
| /* Antes de utilizar esses codigos, inicie a sessão em https://whatsapp-v2.apibrasil.com.br/start */ | |
| /****************************************************************************************************************/ | |
| try { | |
| $curl = curl_init(); | |
| curl_setopt_array($curl, array( | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #BLOCO-1 | |
| upstream myzap-v2 { | |
| server 127.0.0.1:3333; | |
| keepalive 8; | |
| } | |
| server { | |
| server_name SERVER_API; | |
| location / { | |
| proxy_set_header X-Real-IP $remote_addr; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| // vamos fazer os dois endpoints, / e /webhook | |
| $request = $_SERVER['REQUEST_URI']; | |
| $request = explode("/", $request); | |
| $metodo = $_SERVER['REQUEST_METHOD']; | |
| // se existir o indice [1] a gente faz um switch para varias situaçoes | |
| if( isset($request[1]) and $metodo == 'POST' ) { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <!DOCTYPE html> | |
| <!-- Antes de utilizar esses codigos, verifique as informações em https://apibrasil.com.br --> | |
| <html lang="pt-BR"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Document</title> | |
| </head> | |
| <body> |