Wa-automate-nodejs: Get message id for replies to document

Created on 16 Mar 2020  Â·  9Comments  Â·  Source: open-wa/wa-automate-nodejs

Is it possible to get Message id for replies to messages type "document" in the message.quotedMsg object? I wish to use that message id and forward the message.

Steps:
Steps to reproduce the behaviour:

  1. User A asks a question by sending a message.
  2. User B replies with a document.
  3. User A replies to the (2) with a quoted message.
  4. System should be able to get the message id in (2) and forward that document

When I write message.quotedMsg.id, it gives me undefined.

I wish to get the message ID for (2) for I could forward this document using it's message id.

All 9 comments

@alishahlakhani can you provide a screenshot for clarity, please. I'm assuming this would be an issue with any type of file, not just document.

Do you want to get the message-id for 2 from 3? what type of message is 3?

@alishahlakhani please try message.quotedMsgObj.id

@alishahlakhani please try message.quotedMsgObj.id

it returns me 'TypeError: Cannot read property 'id' of null'. It seems like 'quotedMsgObj/quotedMsg' is null. Also why's there 'quotedMsgObj' and 'quotedMsg'?

@alishahlakhani can you provide a screenshot for clarity, please. I'm assuming this would be an issue with any type of file, not just document.

Do you want to get the message-id for 2 from 3? what type of message is 3?

The issue I'm facing is that I am unable to get chat id for reply messages. The id should be there in 'quotedMsgObj/quotedMsg' if I'm not wrong but I don't see it.

@smashah Any idea how to resolve it? I am trying to understand the sulla's underlying code but It's taking time.

@alishahlakhani the reason this happens is because you need to call quotedMsgObj() to get all the details of the quoted message, not just the media data. You should now be able to use the following to get the id of the quoted document message:

message.quotedMsgObject.id

@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`);

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

    await postComment(result);
  })();

Changelog

🚀 Release 1.8.26 (2020-03-29)

Works like a charm! every time. Thanks @smashah 😃

Was this page helpful?
0 / 5 - 0 ratings