Wa-automate-nodejs: Error decrypting media sent

Created on 7 May 2020  Â·  14Comments  Â·  Source: open-wa/wa-automate-nodejs

Describe the bug
When i try to decrypt a media inside a message wich was sent by me it fires an error and doesn't decrypt correctly.

Steps to Reproduce
Steps to reproduce the behavior:

  1. Setup onAnyMessage event handler
  2. try to decrypt message await decryptMedia(message)

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

create('session', {
  headless: true,
  autoRefresh: true,
  args: [
    '--proxy-server="direct://"',
    '--proxy-bypass-list=*'
  ]
}).then(client => start(client));

Expected behavior
receive a file decrypt to be saved on a folder.

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.2017.6',
  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.9.9',
  BROWSER_VERSION: 'HeadlessChrome/81.0.4044.0'
}

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

Host (please complete the following information):

  • OS: Windows

Additional context
Some screenshot image

bug

All 14 comments

@weverkley Please attach all relevant images to the issue next time. That page is full of garbage ads.

This is happening because you get the message when the file starts uploading. At that point, there is no clientUrl leading to the error.

@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.9.10 (2020-05-07)

  • Bump @types/node from 13.13.4 to 13.13.5 #403
  • Release 1.9.10 170e296
  • wait for mediaData when self uploads file in onAnyMessage #407 0b75132
  • feature: added getMessageById ac614ed
  • feature: allow on-demand injection of jsSha a3e5025

@weverkley try the new version. It now waits for the clientUrl before firing the callback. Let me know if it works for you.

@weverkley try the new version. It now waits for the clientUrl before firing the callback. Let me know if it works for you.

awesome, thanks ill try it now

image
Still the same error, its not waiting

@weverkley how are you testing this? I've fixed it for when you upload a file from the host phone. But yeah it doesn't seem to work when sending a file from the bot for which I would ask why you need to decrypt media that you just sent with the bot??

@weverkley how are you testing this? I've fixed it for when you upload a file from the host phone. But yeah it doesn't seem to work when sending a file from the bot for which I would ask why you need to decrypt media that you just sent with the bot??

I am reproducing whatsapp web so i need to send and save them in a local cache to display in the client side, to do it am using onAnyMessage to capture files, decrypt and write to local file system

ok, give me a few mins.

This should fix it: 170e296

@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.9.11 (2020-05-07)

  • Release 1.9.11 099df2c
  • Decrypt should work on all media in onAnyMessage + improved sendImage 9f5d966

@weverkley try it out let me know if it's working now.

@smashah now its working, i can decrypt and save the media, thank you!

Was this page helpful?
0 / 5 - 0 ratings