venom icon indicating copy to clipboard operation
venom copied to clipboard

messageSendResult: 'ERROR_UNKNOWN' in sendImage

Open Gauravism2017 opened this issue 1 year ago • 1 comments

Description

Environment

  • Venom version(s): v5.0.22
  • Browser: [e.g. Chrome 118.0.5993.70]
  • OS: [e.g. AMI 2023]
  • Node version: [e.g.Node 18]

Steps to Reproduce

  1. Create the client and get authenticated on whatsapp.
  2. Trying to send images using the sendImage

Log Output

{ me: { id: { server: 'c.us', user: '91xxxxxxxxx', _serialized: '[email protected]' }, displayName: null, verifiedName: null, searchName: null, pushname: '91xxxxxxxxx', notifyName: null, isBusiness: null, formattedUser: null, tag: '1696238598', eurl: 'https://pps.whatsapp.net/v/xxxxxxxxx_835695434704154_xxxxxxxxxxxxxxxxxxxn.jpg?ccb=11-4&oh=01_AdQTmhUyFu4UfyUUJLCH_iCPgvmt8wFvhuZDJagPna_gSw&oe=65474C4B&_nc_sid=000000&_nc_cat=101', previewEurl: 'https://pps.whatsapp.net/v/xxxxxx/xxxxxxx_835695434704154_xxxxxxxxxxxxxxxxxxxxxx_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=01_AdRfrcyu1ZbxHcdZYjlJkWNCRDAKczpZKrurRjiZu27x3w&oe=65474C4B&_nc_sid=000000&_nc_cat=101', fullDirectPath: '/v/xxxxxxxxxxxx_835695434704154_xxxxxxxxxxxxxxxxxxxxx_n.jpg?ccb=11-4&oh=01_AdQTmhUyFu4UfyUUJLCH_iCPgvmt8wFvhuZDJagPna_gSw&oe=65474C4B&_nc_sid=000000&_nc_cat=101', previewDirectPath: '/v/xxxxxxxxxxxxxx35695434704154_xxxxxxxxxxxxxxxxxx_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=01_AdRfrcyu1ZbxHcdZYjlJkWNCRDAKczpZKrurRjiZu27x3w&oe=65474C4B&_nc_sid=000000&_nc_cat=101', filehash: 'OO4kh6rPaEbzCh+yEeyysWtdddDlzXItW+Wd3Emfexx=', stale: false, eurlStale: false, timestamp: 1698314340366, hostRetryCount: 0 }, to: { fromMe: true, remote: { server: 'g.us', user: '1203xxxxxxxxx', _serialized: '[email protected]' }, id: 'CSZUBLXZWI0YKTSA', _serialized: '[email protected]_CSZUBLXZWI0YKTSA' }, erro: true, text: null, status: { messageSendResult: 'ERROR_UNKNOWN' } }

Your Code

const createClientInstance = async () => {
  const _session = 'started';
  const _client = await create(
    'whatsapp-bot',
    async (base64Qrimg, asciiQR, attempts, urlCode) => {
      console.log('Number of attempts to read the qrcode: ', attempts);
      console.log('Terminal qrcode: ', asciiQR);
      console.log('base64 image string qrcode: ', base64Qrimg);
      console.log('urlCode (data-ref): ', urlCode);
      const fileName = `qr_code_${new Date().getTime()}.png`;
    },
    // statusFind
    (statusSession: string, session: string) => {
      console.log('Status Session: ', statusSession);
      console.log('Session name: ', session);
    },
    // options
    {
      session: 'test-session',
      folderNameToken: 'tokens', //folder name when saving tokens
      mkdirFolderToken: '', //folder directory tokens, just inside the venom folder, example:  { mkdirFolderToken: '/node_modules', } //will save the tokens folder in the node_modules directory
      headless: 'new', // Headless chrome
      devtools: true, // Open devtools by default
      // useChrome: true, // If false will use Chromium instance
      debug: true, // Opens a debug session
      logQR: true, // Logs QR automatically in terminal
      browserWS: '', // If u want to use browserWSEndpoint
      browserArgs: [
        '--no-sandbox',
        '--disable-setuid-sandbox',
        '--disable-dev-shm-usage',
        '--disable-accelerated-2d-canvas',
        '--no-first-run',
        '--no-zygote',
        '--single-process', // <- this one doesn't works in Windows
        '--disable-gpu'
      ], // Parameters to be added into the chrome browser instance
      puppeteerOptions: {}, // Will be passed to puppeteer.launch
      disableSpins: false, // Will disable Spinnies animation, useful for containers (docker) for a better log
      disableWelcome: false, // Will disable the welcoming message which appears in the beginning
      updatesLog: true, // Logs info updates automatically in terminal
      autoClose: 60000, // Automatically closes the venom-bot only when scanning the QR code (default 60 seconds, if you want to turn it off, assign 0 or false)
      createPathFileToken: false, //creates a folder when inserting an object in the client's browser, to work it is necessary to pass the parameters in the function create browserSessionToken
      attemptsForceConnectLoad: 10
    }
  );

  _client.onMessage((message) => {
    // console.log('Message: ', message, 'at: ', new Date());
  });
  _client.onAck((ack) => {
    // console.log('Ack: ', ack, 'at: ', new Date());
  });
  _client.onStreamChange((state) => {
    console.log('State Connection Stream: ', state, 'at: ', new Date());
  });
  return _client;
};

const test = async () => {
  const client = await createClientInstance();
  await client.sendImage('[email protected]', 'sample.png', 'sample.png', 'test');
  }
  test()

Additional context / Screenshot

Add any other context about the problem here. If applicable, add screenshots to help explain.

Gauravism2017 avatar Oct 26 '23 10:10 Gauravism2017

wait client.sendImage(message.from, 'url_da_imagem', 'nome-da-imagem' ,'texto-da-imagem'); unnamed (2)

allanalcantara avatar Nov 14 '23 13:11 allanalcantara

New Release: npm i [email protected] We have support for Venom for just $15 per month, if you are interested, call our support via the link: https://web.whatsapp.com/send?phone=5561985290357

orkestral avatar Apr 03 '24 15:04 orkestral