Wa-automate-nodejs: Feature: External Webhook

Created on 26 May 2020  Â·  6Comments  Â·  Source: open-wa/wa-automate-nodejs

Is it possible to forward messages, audio video, gif, stickers, to an external webhook?

Most helpful comment

@jersonjunior the reason the webhooks arent built in is because I don't know which wevhooks you would want to subscribe to.

I made this demo and you can edit it as you like. It literally cannot be made any easier

https://github.com/open-wa/wa-automate-nodejs/blob/master/demo/simple_server.ts

All 6 comments

Webhooks won't be implemented as part of the library any time soon. You can edit server.ts and make a PR to show how to set up webhooks easily though.

I'm trying to run server.js, but this error always occurs:

ts-node server.ts

/usr/local/lib/node_modules/ts-node/src/index.ts:434
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
server.ts:6:41 - error TS2307: Cannot find module '@open-wa/wa-automate' or its corresponding type declarations.

6 import { Client, decryptMedia, ev} from '@open-wa/wa-automate';
                                          ~~~~~~~~~~~~~~~~~~~~~~

    at createTSError (/usr/local/lib/node_modules/ts-node/src/index.ts:434:12)
    at reportTSError (/usr/local/lib/node_modules/ts-node/src/index.ts:438:19)
    at getOutput (/usr/local/lib/node_modules/ts-node/src/index.ts:578:36)
    at Object.compile (/usr/local/lib/node_modules/ts-node/src/index.ts:775:32)
    at Module.m._compile (/usr/local/lib/node_modules/ts-node/src/index.ts:858:43)
    at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/usr/local/lib/node_modules/ts-node/src/index.ts:861:12)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

I found a Webhook implementation using your project as a base:: https://github.com/joaomirandasa/whats2api/blob/master/modules/whatsapp.js

@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.50 (2020-05-27)

  • Release 1.9.50 76d98eb
  • Feature: Created simple full API (with webhooks) demo #487 a2b8470
  • added p-queue as dev dependency ef57ace
  • fixed custom browser revision id setting c516d29

@jersonjunior the reason the webhooks arent built in is because I don't know which wevhooks you would want to subscribe to.

I made this demo and you can edit it as you like. It literally cannot be made any easier

https://github.com/open-wa/wa-automate-nodejs/blob/master/demo/simple_server.ts

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bubaew95 picture bubaew95  Â·  6Comments

blackchineykh picture blackchineykh  Â·  4Comments

phantom-limb picture phantom-limb  Â·  5Comments

vsilva472 picture vsilva472  Â·  4Comments

arisros picture arisros  Â·  4Comments