Skip to content

Começando

Inicio Rápido

Execute o seguinte comando para garantir que o SuperChats esteja instalado:

bash
$ npm install superchats

ou use yarn

bash
$ yarn add superchats

Exemplo de Código Base JavaScript

javascript

// Função para Javascript

const superchats = require("superchats");

async function start(){
let client = await superchats.create({
  session: "Marketing",
  license: "asjdh-efddff734-sdsdf834-233272",
  driveStorage: "local",
  qr?: false, // Breve
  code?: true, // Breve
  phoneNumber?: '5561985290357', // Breve
  nodata?: true,
  logQr?: false,
  alwaysOn?: true, 
  autoRead?: true, 
  nodata?: true, 
  logQr?: true,
  statusFind: async (status) => {
    console.log(status)
  },
  pairing?: async (session, code) => {
  console.log(`code: ${code}`);
  },
  qrcode: async (session, base64Img, asciiQR, urlCode) => {
  console.log(asciiQR)
  },
  onAnyMessage?: async (message) => {
     if ((message.type == "text" || message.subtype == 'text')  && message.content == "hi") {
       await client.sendText(message.from, "Let's GO Superchats");
     }
   }  // Receive an event all the time you receive a message from some contact
})

return client;

}



(async function(){
  let client = await start();
  let response = await client.sendText('0000000000000', 'Obrigado por usar SuperChats!!!');
  console.log(response);
})()

Exemplo de Código Base TypeScript

typescript
import { create, Types } from "superchats";

(async function(){
    const superchats: Promise<Types> = await create('Marketing', {
        license: 'asjdh-efddff734-sdsdf834-233272',
        // Mesmos parâmetros do exemplo em javascript;
    })

    const resposta = (await superchats).sendText('0000000000000', 'Obrigado por usar SuperChats!!!')

    console.log(await resposta)
  })()

All rights reserved to Orkestral LLC