Is it possible to forward messages, audio video, gif, stickers, to an external webhook?
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`);
})();
@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
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