Wa-automate-nodejs: Stuck after WAPI Reinjected

Created on 27 Jun 2020  Â·  9Comments  Â·  Source: open-wa/wa-automate-nodejs

Describe the bug
I try to running with simple code as showing in the Readme.md. But I got stuck after WAPI Reinjected.

Expected behavior
Can running simple usage example like on Readme.md

DEBUG INFO
(node:2869) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'safeMode' of undefined
at Object. (/home/gevanni/Documents/Development/NodeJS/AutoTexting/node_modules/@open-wa/wa-automate/dist/controllers/initializer.js:240:33)
at step (/home/gevanni/Documents/Development/NodeJS/AutoTexting/node_modules/@open-wa/wa-automate/dist/controllers/initializer.js:63:23)
at Object.next (/home/gevanni/Documents/Development/NodeJS/AutoTexting/node_modules/@open-wa/wa-automate/dist/controllers/initializer.js:44:53)
at fulfilled (/home/gevanni/Documents/Development/NodeJS/AutoTexting/node_modules/@open-wa/wa-automate/dist/controllers/initializer.js:35:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:2869) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2869) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Debug Info {
  WA_VERSION: '2.2025.6'
  PAGE_UA: 'WhatsApp/2.2019.8 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
  WA_AUTOMATE_VERSION: '1.9.86',
  BROWSER_VERSION:  'HeadlessChrome/83.0.4103.0'
}

Host (please complete the following information):

  • OS: iOS
bug

All 9 comments

please share your create code @kresnaputra

@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.87 (2020-06-27)

  • Release 1.9.87 e267ece
  • Massively simplified majority of listeners, register listeners #589 9628a28
  • Feature: Implemented client.refresh() #582 bc997c5
  • Prelim work for refresh and reinjection #582 5abc74b
  • Replaced ExposedFn with SimpleListener #588 cb2e132
  • Using SimpleListener wherever applicable #588 #589 279f202
  • BREAKING: Refactor AvailableWebhooks to SimpleListener #588 a226e80
  • Migrate onAck from middleware to client #588 c058eee
  • Migrate onMessage from middleware to client #588 2320773
  • chore: remove redundant code in client 63e5794
  • Replaced string function names with SimpleListener #588 bb10f61
  • Migrate onAnyMessage from middleware to client #588 8e811f6
  • remove redundant code, added sessionInfo model to docs e19c5d3
  • Refactor page close listener #582 411ab28
  • Commented out middleware script tag #588 14904d4
  • fix: add missing optional chaining for safemode config #590 cfcb136
  • Export license check url eb647ee

please share your create code @kresnaputra

const format = require("date-fns/format");
const wa = require("@open-wa/wa-automate");
const dotenv = require("dotenv");
dotenv.config();

const MEGA = process.env.PHONE_NUMBER;

wa.create().then((client) => start(client));

function calculationTime(client) {
setInterval(() => {
if (format(new Date(), "k m s") === "7 0 0") {
client.sendText(MEGA, "Hello");
}
}, 1000);
}

function replyMega(message, client) {
if (message.body.toLocaleLowerCase().includes("Test"))
client.sendText(MEGA, "Testing");
}

function start(client) {
calculationTime(client);

client.onMessage((message) => {
// Checking if sender is mega
if (message.from === MEGA) {
replyMega(message, client);
}
});
}

I already updated to newest version '1.9.88', after updated i got some error but the log come after "Passed Integrity Test"

wa.create({}).then((client)

@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.90 (2020-06-28)

Should be fixed now

Should be fixed now

Thanks, it's work like charm now

Was this page helpful?
0 / 5 - 0 ratings