Wa-automate-nodejs: sendImageAsSticker is not working

Created on 21 Apr 2020  Â·  6Comments  Â·  Source: open-wa/wa-automate-nodejs

Describe the bug
client.sendImageAsSticker never resolves and does not throw any error

Steps to Reproduce
Steps to reproduce the behavior:

  1. Run the code

create() code
This is the code you use to create the client. e.g

const fs = require('fs')
const wa = require('@open-wa/wa-automate');

wa.create({
  headless: false,
  devtools: true 
}).then(client => start(client));

function start(client) {
  client.onMessage(async message => {
    if (message.body === 'Hi') {
      await client.sendText(message.from, '👋 Hello!')
      const mimetype = 'jpg'
      const b64 = fs.readFileSync('./assets/image.jpg').toString('base64')
      await client.sendImageAsSticker(`data:${mimetype};base64,${b64}`, message.from)
    }
  });
}

Expected behavior
client.sendImageAsSticker should send the given image as sticker

DEBUG INFO
This is the info printed to the console when you start your app. It should look like this

Debug Info {
  WA_VERSION: '2.2013.7',
  PAGE_UA: 'WhatsApp/0.4.613 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36',
  WA_AUTOMATE_VERSION: '1.8.69',
  BROWSER_VERSION: 'Chrome/80.0.3987.0'
}

Screenshots
If applicable, add screenshots to help explain your problem. Use headless: false to get screenshots

Host (please complete the following information):

  • OS: [e.g. iOS] Windows 10

Additional context
Add any other context about the problem here.
The image I'm trying to send https://avatars2.githubusercontent.com/u/31698109?s=400&u=5788383d90807c8c157a778426431fff3d6dd8f3&v=4

enhancement good first issue

Most helpful comment

@renato-macedo it should be live in v1.8.72

Please report back if it is working for you.

Thanks

All 6 comments

@renato-macedo Thanks for making the issue. One last question. Are you sure the paths are correct? When you have a relative path it goes from your pwd and not relative from the file with the code. Either way looks like it would be useful here to have a sendStickerfromUrl method.

@renato-macedo

In the upcoming version, this has been tested to be working:

      await client.sendStickerfromUrl(message.from, 'https://avatars2.githubusercontent.com/u/31698109?s=400&u=5788383d90807c8c157a778426431fff3d6dd8f3&v=4')

@github-actions run


âš¡ Release! âš¡

(async () => {
function exec(cmd) {
  console.log(execSync(cmd).toString());
}

// Config
const gitUserEmail = "github-actions[bot]@users.noreply.github.com";
const gitUserName = "github-actions[bot]";

exec(`echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc`);
exec(`git config --global user.email "${gitUserEmail}"`);
exec(`git config --global user.name "${gitUserName}"`);
exec(`npm i`);
exec(`npm run release-ci`);

//comment on the issue
var result = execSync(`npx auto-changelog -o ./tempchangelog.txt --commit-limit false --template ./compact-keepachangelog.hbs --stdout`).toString();

    await postComment(result);

//create changelog image
exec(`npm run release-image`);
exec(`git commit -a -m 'updated release-image'`);
exec(`git push --force`);
  })();

Changelog

🚀 Release 1.8.72 (2020-04-20)

  • Release 1.8.72 d85c936
  • added sendStickerfromUrl switched params in sendImageAsSticker !BREAKING! #340 5fe40c6
  • Update comment-run.yml e6c7d79
  • Update comment-run.yml 1a94995
  • update release image 761ae52

@renato-macedo it should be live in v1.8.72

Please report back if it is working for you.

Thanks

Thank you very much!
It's working now.

Was this page helpful?
0 / 5 - 0 ratings