open-wa / wa-automate-nodejs Goto Github PK
View Code? Open in Web Editor NEW๐ฌ ๐ค The most reliable tool for chatbots with advanced features. Be sure to ๐ this repository for updates!
Home Page: https://docs.openwa.dev/
License: Other
๐ฌ ๐ค The most reliable tool for chatbots with advanced features. Be sure to ๐ this repository for updates!
Home Page: https://docs.openwa.dev/
License: Other
I cannot read the qrcode captured with method bellow:
sulla.ev.on('qr', async qrcode => {
//qrcode is base64 encoded qr code image
//now you can do whatever you want with it
const imageBuffer = Buffer.from(
qrcode.replace('data:image/png;base64,', ''),
'base64'
);
fs.writeFileSync('qr_code.png', imageBuffer);
});
The quality of image is very bad.
is possible to create a Message of type 'product' ?
https://github.com/Rhymen/go-whatsapp/blob/master/binary/proto/def.proto
https://blog.whatsapp.com/10000665/Introducing-Catalogs-for-Small-Businesses
https://www.youtube.com/watch?v=ugFIVoh9IEQ
Development worked perfectly on OSX, when the production byproduct to run a final test presented a problem 'eventEmitter2 loader.js error'.
I am still exploring what it can be. If anyone has any information as to what this error is occurring. Appreciate!
Congratulations on the project =)
the qrcode loader is undefined when the session was previously created
Would it be possible to create a new Group with message.from (contactid) and another contact id?
Then make it so main phone leaves the group afterwards.
Thank you for your time
how can manage two or more phone number sessions. and how can identify which session related with which phone number.
await client.sendVideoAsGif(message.from, data:video/mp4;base64,${d4.body}
, dad.mp4
, "teste")
i want to post a message when an event like this happens, in order to post rules in a group, etc. is possible this?.
Hi, can you comment on an implementation of sending images?
I have a use case where I need some alert when the main device is offline.
The method I found is WAPI.isConnected
, essentially detecting the 'Phone not connected' banner in the UI.
However it doesn't work as in the method doesn't return false
when the main device is offline.
The command document.querySelector('*[data-icon="alert-phone"]')
is working in web.whatsapp browser.
Anyone have ideas?
Hello users, Is there any way to hadle the error displaying when I am not online?
I am not online on my phone, but I don't want that to affect my app.
How can I do that?
help me with the installation commands.
without using this command npm i --save sulla-hotfix
Only with the cloning of your project.
help example send image for index.js
I'm trying to import 50,000 contacts and get this error:
(node:36093) UnhandledPromiseRejectionWarning: Error: 4 DEADLINE_EXCEEDED: Deadline exceeded
at Object.callErrorFromStatus (/project/node_modules/@grpc/grpc-js/build/src/call.js:30:26)
at Http2CallStream.call.on (/project/node_modules/@grpc/grpc-js/build/src/client.js:96:33)
at Http2CallStream.emit (events.js:203:15)
at process.nextTick (/project/node_modules/@grpc/grpc-js/build/src/call-stream.js:75:22)
at process._tickCallback (internal/process/next_tick.js:61:11)
Hello,
I'm trying to use the 1.2.11 version and the method bellow are getting error:
Message error:
(node:49060) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'participants' of undefined
at Object.window.WAPI._getGroupParticipants (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/sulla-hotfix/dist/lib/wapi.js:548:21)
at async Object.window.WAPI.getGroupParticipantIDs (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/sulla-hotfix/dist/lib/wapi.js:559:21)
at ExecutionContext._evaluateInternal (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/puppeteer/lib/ExecutionContext.js:122:13)
at process._tickCallback (internal/process/next_tick.js:68:7)
-- ASYNC --
at ExecutionContext. (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/puppeteer/lib/helper.js:111:15)
at DOMWorld.evaluate (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/puppeteer/lib/DOMWorld.js:112:20)
at process._tickCallback (internal/process/next_tick.js:68:7)
-- ASYNC --
at Frame. (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/puppeteer/lib/helper.js:111:15)
at Page.evaluate (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/puppeteer/lib/Page.js:863:43)
at Page. (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/puppeteer/lib/helper.js:112:23)
at Whatsapp. (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/sulla-hotfix/dist/api/whatsapp.js:164:50)
at step (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/sulla-hotfix/dist/api/whatsapp.js:33:23)
at Object.next (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/sulla-hotfix/dist/api/whatsapp.js:14:53)
at /Users/foka/dev/workspace-estudos/whatsapp/node_modules/sulla-hotfix/dist/api/whatsapp.js:8:71
at new Promise ()
at __awaiter (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/sulla-hotfix/dist/api/whatsapp.js:4:12)
at Whatsapp.getGroupMembersId (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/sulla-hotfix/dist/api/whatsapp.js:161:16)
at /Users/foka/dev/workspace-estudos/whatsapp/src/router/whatsrouter.js:53:16
at Layer.handle [as handle_request] (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/foka/dev/workspace-estudos/whatsapp/node_modules/express/lib/router/route.js:137:13)
Store.Msg.on("change:ack", c => console.log(c))
I have over 50,000 contacts on my phone, and when I read QRCODE, nothing happens. Does anyone have something like that?
Hi, my qr code catcher is no longer working after updating my npm.
ev.on('qr', async qrcode => { console.log(qrcode) })
@smashah You have now stopped loading QR CODE
Hi.
Audio decryption is needed, currently this fails.
Describe the bug
decryptMedia() function is not working.
sulla-hotfix version
1.5.7
Whatsapp version
0.4.315
Hey I am getting the following error while getting messages using chat id
const chatMessages = await client.getAllMessagesInChat( {chatId: chat.id, includeMe: true, includeNotifications: true} ).then(message => { console.log(message); }).catch((error) => { console.error(error); });
can you please help / guide; what am I doing wrong?
Error: Evaluation failed: TypeError: Cannot read property 'sendMessage' of undefined at Object.window.WAPI.getChat (C:\wamp64\www\sulla-hotfix\node_modules\sulla-hotfix\dist\lib\wapi.js:289:32) at Object.window.WAPI.getAllMessagesInChat (C:\wamp64\www\sulla-hotfix\node_modules\sulla-hotfix\dist\lib\wapi.js:618:23) at __puppeteer_evaluation_script__:3:41 at ExecutionContext._evaluateInternal (C:\wamp64\www\sulla-hotfix\node_modules\puppeteer\lib\ExecutionContext.js:122:13) at <anonymous> at process._tickCallback (internal/process/next_tick.js:189:7) -- ASYNC -- at ExecutionContext.<anonymous> (C:\wamp64\www\sulla-hotfix\node_modules\puppeteer\lib\helper.js:111:15) at DOMWorld.evaluate (C:\wamp64\www\sulla-hotfix\node_modules\puppeteer\lib\DOMWorld.js:112:20) at <anonymous> -- ASYNC -- at Frame.<anonymous> (C:\wamp64\www\sulla-hotfix\node_modules\puppeteer\lib\helper.js:111:15) at Page.evaluate (C:\wamp64\www\sulla-hotfix\node_modules\puppeteer\lib\Page.js:863:43) at Page.<anonymous> (C:\wamp64\www\sulla-hotfix\node_modules\puppeteer\lib\helper.js:112:23) at Whatsapp.<anonymous> (C:\wamp64\www\sulla-hotfix\node_modules\sulla-hotfix\dist\api\whatsapp.js:245:50) at step (C:\wamp64\www\sulla-hotfix\node_modules\sulla-hotfix\dist\api\whatsapp.js:33:23) at Object.next (C:\wamp64\www\sulla-hotfix\node_modules\sulla-hotfix\dist\api\whatsapp.js:14:53) at C:\wamp64\www\sulla-hotfix\node_modules\sulla-hotfix\dist\api\whatsapp.js:8:71 at new Promise (<anonymous>) at __awaiter (C:\wamp64\www\sulla-hotfix\node_modules\sulla-hotfix\dist\api\whatsapp.js:4:12) at Whatsapp.getAllMessagesInChat (C:\wamp64\www\sulla-hotfix\node_modules\sulla-hotfix\dist\api\whatsapp.js:242:16) at allChats.forEach (C:\wamp64\www\sulla-hotfix\index.js:16:37) at Array.forEach (<anonymous>) at start (C:\wamp64\www\sulla-hotfix\index.js:15:11) at <anonymous>
Is there any way I can get all contacts from a broadcast list?
Both sendFile() and sendImage() sends a static GIF.
How could you send a contact? I have tried in many ways without success
// import { create, Whatsapp } from 'sulla-hotfix';
const sulla = require('sulla');
sulla.create().then(client => start(client));
function start(client) {
client.onMessage(message => {
if (message.body === 'Hi') {
client.sendText(message.from, '๐ Hello from sulla!');
//Sending a contact here
try {
client.sendText(message.from, 'begin ---------');
client.sendContact(message.from,client.getContact(message.from));
client.sendText(message.from, 'end -----------');
} catch (err) {
console.log(err.message);
}
}
});
}
It would be cool if I can have something like:
client.getLiveLocations()
to see who is sharing their live locations with me and then subsequently I would be able to provide them with some geographically contextual response.
Notes:
In order to grab live locations from whatsapp web right now you can enter this into the console:
window.Store.LiveLocation.toJSON().forEach(l=>{console.log(l.participants[0].id._serialized,l.participants[0].lat, l.participants[0].lng,new Date(l.participants[0].expiration*1000))})
Scenario:
Develop on macbook => scan qr code
Deploy on server => scan qr code
Develop on macbook => Gets stuck on qr code, need to delete sessions, scan qr code
Deploy on server => Gets stuck on qr code, need to delete sessions, scan qr code
I can't make sendLocation work.
My code
const sulla = require('sulla-hotfix');
sulla.create().then(client => start(client));
function start(client) {
client.onMessage(async message => {
if (message.body === 'Hi') {
await client.sendText(message.from, '๐ Hello from sulla!'); //It's working
}
if (message.body === 'Local') {
console.log("Local"); //It's working
await client.sendLocation(message.from, '-19.922783', '-43.945161', 'My Local'); //This is not working
}
await client.simulateTyping(message.from,true);//It's working
});
}
sendImage and sendFile do not handle video messaging(. I have a base64 like
let mediaData = 'data:{mime};base64,{base64}'
where mime is geeting with npm: mime-types
. I have no message delivered with this piece(
Tried sending an text today, error thrown was
`(node:6383) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'sendMessage' of undefined
at Object.window.WAPI.getChat (/home/menudib/Desktop/Chatbot/node_modules/sulla-hotfix/dist/lib/wapi.js:289:32)
at Object.window.WAPI.sendSeen (/home/menudib/Desktop/Chatbot/node_modules/sulla-hotfix/dist/lib/wapi.js:828:28)
at puppeteer_evaluation_script:3:34`
Currently, I can only send a message to contacts who already have a conversation started. When I try to send to a new error contact.
The following error occurs randomly without any apparent reason.
whatsapp_1 | (node:1) UnhandledPromiseRejectionWarning: Error: Page crashed!
whatsapp_1 | at Page._onTargetCrashed (/app/node_modules/puppeteer/lib/Page.js:216:24)
whatsapp_1 | at CDPSession.Page.client.on.event (/app/node_modules/puppeteer/lib/Page.js:124:56)
whatsapp_1 | at CDPSession.emit (events.js:198:13)
whatsapp_1 | at CDPSession._onMessage (/app/node_modules/puppeteer/lib/Connection.js:200:12)
whatsapp_1 | at Connection._onMessage (/app/node_modules/puppeteer/lib/Connection.js:112:17)
whatsapp_1 | at WebSocketTransport._ws.addEventListener.event (/app/node_modules/puppeteer/lib/WebSocketTransport.js:44:24)
whatsapp_1 | at WebSocket.onMessage (/app/node_modules/ws/lib/event-target.js:120:16)
whatsapp_1 | at WebSocket.emit (events.js:198:13)
whatsapp_1 | at Receiver.receiverOnMessage (/app/node_modules/ws/lib/websocket.js:789:20)
whatsapp_1 | at Receiver.emit (events.js:198:13)
whatsapp_1 | at Receiver.dataMessage (/app/node_modules/ws/lib/receiver.js:422:14)
whatsapp_1 | at Receiver.getData (/app/node_modules/ws/lib/receiver.js:352:17)
whatsapp_1 | at Receiver.startLoop (/app/node_modules/ws/lib/receiver.js:138:22)
whatsapp_1 | at Receiver._write (/app/node_modules/ws/lib/receiver.js:74:10)
whatsapp_1 | at doWrite (_stream_writable.js:415:12)
whatsapp_1 | at writeOrBuffer (_stream_writable.js:399:5)
whatsapp_1 | at Receiver.Writable.write (_stream_writable.js:299:11)
whatsapp_1 | at Socket.socketOnData (/app/node_modules/ws/lib/websocket.js:864:35)
whatsapp_1 | at Socket.emit (events.js:198:13)
whatsapp_1 | at addChunk (_stream_readable.js:287:12)
whatsapp_1 | at readableAddChunk (_stream_readable.js:268:11)
whatsapp_1 | at Socket.Readable.push (_stream_readable.js:223:10)
whatsapp_1 | (node:1) 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: 10)
whatsapp_1 | (node:1) [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.
This error doesn't kill the node process, so the container never restart and, therefore, the bot stop working.
Can you help me find why this error occurs?
Hi,
Is there any simple way to check if it's connected and still working after sulla create?
sulla.create().then(client => start(client));
I wanted to check if it's connected but the code is running so how can I check from outside? Can I check in the session folder for something?
Actually I tried to add it myself, but it doesn't seem to work. The image url that required credentials can't be downloaded.
I can send media without problems but when it comes to an image > 200k it fails not errors caught nothing
Hi! I want to listen on "qr" event only for specific whatsapp phone/account.
The problem is "qr" event is emitted each time a phone number wants to authenticate, so I can't no which phone exactly is about to scan the code.
I'm asking if you can implement dynamic events emitter for the qr code scanning.
I was thinking about something like:
let dynamicEventId1: string = 'one_id'
let dynamicEventId2: string = 'another_id'
const qrcode1 = 'data:image/png;base64,...'
const qrcode2 = 'data:image/png;base64,...'
// Create the session instance with the specific event id.
sullaHotfix.create('session1', puppeteerConfigOverride, customAgent, /*options*/{eventId = dynamicEventId1})
sullaHotfix.create('session2', puppeteerConfigOverride, customAgent, /*options*/{eventId = dynamicEventId2})
// Listen All (look at the param "eventId")
ev.on(`qr`, (qrcode, eventId) => {
if (eventId === dynamicEventId1) {
//
} else if (eventId === dynamicEventId2) {
//
}
})
// Emit all (look at the param "eventId")
ev.emit(`qr`, qrcode, dynamicEventId1)
ev.emit(`qr`, qrcode, dynamicEventId2)
or
let dynamicEventId1: string = 'one_id'
let dynamicEventId2: string = 'another_id'
const qrcode1 = 'data:image/png;base64,...'
const qrcode2 = 'data:image/png;base64,...'
// Create the session instance with the specific event id.
sullaHotfix.create('session1', puppeteerConfigOverride, customAgent, /*options*/{eventId = dynamicEventId1})
sullaHotfix.create('session2', puppeteerConfigOverride, customAgent, /*options*/{eventId = dynamicEventId2})
// Listen on only one specific id
ev.on(`qr/${dynamicEventId1}`, (qrcode, eventId) => {
//
})
// Listen All
ev.on(`qr`, qrcode => {
//
})
// Emit for only one specific id.
ev.emit(`qr/${dynamicEventId1}`, qrcode, dynamicEventId)
// Emit all
ev.emit(`qr`, qrcode)
ReferenceError: WAPI is not defined error thrown while sending and receiving is dead
After a message is sent, I want to be able to know that the receiver read or not the message.
hi there
please consider to implement forward Message function
thanks
mukulhase/WebWhatsapp-Wrapper#581
https://github.com/mukulhase/WebWhatsapp-Wrapper/pull/494/files
I'am trying to send an link with thumbnail but i realize this functions does not exist yet in library, anyone already develop this function by ourselves? I've tried to send but don't know why not function properly, someone can help me?
i see function WAPI.sendMessageWithThumb
already exist but i did not realize how to use that, look my attempt of develop:
Whatsapp.prototype.sendMessageWithThumb = function (to, thumb,url,title,description) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: return [4, this.page.evaluate(function (_a) { var to = _a.to, thumb = _a.thumb, url = _a.url, title = _a.title, description = _a.description; return WAPI.sendMessageWithThumb(thumb, url, title, description, to); },{ to: to, thumb: thumb, url: url, title: title, description: description })]; case 1: return [2, _a.sent()]; } }); }); };
#Edit
Making a screen capture from puppeteer and this is showed
in a file: whatsapp.js
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.