Skip to content

Parameters

Optional Parameters

Optional parameters are initiated along with the connection as connection events. QRCODE and STATUSFIND, plus extra options

javascript
const superchats = require("superchats");

superchats.create({
    session: "Marketing",
    license: "asjdh-efddff734-sdsdf834-233272", // Valid license to use Superchats
    driveStorage: "local", // use Storage Local or Mongo (default = local)
    mongoUrl?: "mongodb://localhost:27017", // for storage mongo is required
    amqpUrl?: "amqp://localhost:5672", // Fila RabbitMQ para armazenar no mongo é obrigatório
    welcomeScreen?: true, // Show or hide welcome in terminal
    welcomeText?: 'Name', // Set a new name for intro and browser device
    qr: false, // Brief
    code?: true, // Brief
    phoneNumber?: '5561985290357', // Brief
    retries?: 5, // Set number of qrcode in terminal before of close
    alwaysOn?: true, // Mark Chat as always online
    autoRead?: true, // Read all received messages
    nodata?: true, // Don't get all device history (default = false)
    nodataFull?: true, // Don't get all device history full (default = false)
    logQr?: true, // (Default is true) Automatically registers QR on terminal
    proxy?: "http://user:password@provedorproxy.com:12233", // Use proxy just passing the HTTP URL | HTTPS
    pairing?: async (session, code) => {
    console.log(`code: ${code}`);
    },
    qrcode: (sessionId, base64QR, asciiQR, urlCode) => {
    console.log("sessionId: " + sessionId)
    console.log("base64 image of qrcode: " + base64QR);
    console.log("Terminal image of qrcode in caracter ascii: " + asciiQR);
    console.log("Terminal string hash of qrcode: " + urlCode);
     },
    statusFind: (statusSession) => {
    console.log("Status Session: ", statusSession);
     },
   syncHistory?: (percent) => { // Receive the data synchronization percentage event as soon as it connects
    console.log(percent);
     },
    onAck?: (event) => {    // Receive a status every time you send a message to a contact: failed, pending, sent, received or read
     console.log(event)
     },
     onAnyMessage?: (event) => {    // Receive events every time you send or receive a message
     console.log(event)
     },
    onPresence?: (event) => { // Receive an event whenever a contact is: typing, recording, online or offline with you
     console.log(event)
     },
    onGroups?: (event) => { // Receive events whenever a group name, settings change
     console.log(event)
     },
    onParticipants?: (event) => { // Receives events related to group participants such as: who joined, left, promoted to admin...
     console.log(event)
     },
    onCall?: (event) => { // Receive event every time you receive a voice or video call
     console.log(event)
     }

All rights reserved to Orkestral LLC