danielcardeenas / sulla Goto Github PK
View Code? Open in Web Editor NEW👩🏻🔬 Javascript Whatsapp api library for chatbots
License: MIT License
👩🏻🔬 Javascript Whatsapp api library for chatbots
License: MIT License
Hi!
I'm trying to contribute by adding features to the project (like sending messages to an ID, etc) but I can't find the way to test it.
I forked the project, run npm install
, made the modifications, and then npm run-script build
, so the dist folder is generated.
I've also created a "testing" project where I use npm install [sulla_local_path]
. The problem is when I run the test project, I get:
UnhandledPromiseRejectionWarning: TypeError: puppeteer.launch is not a function
at C:\nodeprojects\sulla\dist\controllers\browser.js:96:46
at step (C:\nodeprojects\sulla\dist\controllers\browser.js:32:23)
at Object.next (C:\nodeprojects\sulla\dist\controllers\browser.js:13:53)
at C:\nodeprojects\sulla\dist\controllers\browser.js:7:71
at new Promise (<anonymous>)
at __awaiter (C:\nodeprojects\sulla\dist\controllers\browser.js:3:12)
at initBrowser (C:\nodeprojects\sulla\dist\controllers\browser.js:92:12)
at Object.<anonymous> (C:\nodeprojects\sulla\dist\controllers\browser.js:53:36)
at step (C:\nodeprojects\sulla\dist\controllers\browser.js:32:23)
at Object.next (C:\nodeprojects\sulla\dist\controllers\browser.js:13:53)
(node:10176) 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: 2)
(node:10176) [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.
I check in my testing project node_modules folder and there is the puppeteer and sulla folder.
What steps am I missing?
Thanks for this project! And sorry for the bad english.
Greetings
Are any apis available for getting contact online updates?.
Hi All,
Good project, well done!
How to read all unread msgs from all chats?
How to manage, save multiple instance of whatsapp web, for more than one user / number?
plz where is the functions, events, docs?
How can I make a Forward of a message to send it by another chat?
pd: It is an incredible job I hope you continue developing it and I would be interested above all the stickers
Hello, great god. I switched to your framework. You can get Store.CryptoLib.decryptE2EMedia(e, t, n, r, a). Personally think that this can decrypt pictures or audio. I tried to crack. Guess the message obtained with Store.Chat.get(id).msgs. /**
* e may be __x_type
* t ArrayBuffer not detected
* n __x_mediaKey
* r may be __x_mimetype
* a may be __x_mediaKeyTimestamp
*/
I don't know if God is free to decrypt it.
Help Me Please :C not runnning 'sulla' :'( my log
`internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'sulla'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/home/theblood/Server_WH/start.js:2:15)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
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)`
While fetching all chats and chats with new messages, the Msgs array is returned empty.
Is there a specific way to query chats with messages or is there a way to query messages for a particular chat using its ID?
Please advise.
BTW, Great Job..
Hi @danielcardeenas , I'm receiving Base64 whenever any user sends me an image. If I'm converting that Base64 to image file, the converted image is very small in size and blurry. Can you suggest anything so that I can get original image back.
How to send qr code via rest api and retrieve the return and set in the library?
Does anyone have any repository, working with the library in the format rest?
How to get user status(online/offline)?
Hello, i'm trying to send message to a phone number that isn't in my chat tab, a new number. The number that is in international format, but i cant send. Is anyone with the same problem. Below is my code:
// import { create, Whatsapp } from 'sulla';
const sulla = require('sulla');
const express = require('express');
const app = express();
sulla.create().then(client => start(client));
function start(client) {
app.get("/:numero/:msg/", function(req, res){
client.sendText(req.params.numero + '@c.us',req.params.msg);
res.sendFile(__dirname + '/html/index.html');
})
}
app.listen(8090, function(){
console.log("servidor rodando");
});
This would be my main application anyways so I just want to know if and if yes how its possible to do this. This in combination with media sending and recieving witch is hopfully on its way would make the perfect WhatsApp-Bot.
How to repply location?
First of all, my thanks to Daniel for such an excellent tool. Could someone please put an example on how to get a value from a mysql table, validate it if it is less than 12 that sends an alert to two or three contacts? It is a voltage monitoring. My thanks again.
How could you send a contact? I have tried in many ways without success
// import { create, Whatsapp } from 'sulla';
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);
}
}
});
}
Hi, i am trying to get is user online status,
How can i detect user online status?
Hi, i'm try to use but if the contact don't has a previews talk with me i cant start a new conversation. This is normal? Has plane for implementation this in the future?
First of all, great work on the app.
I tried sending messages to couple of new numbers with this:
function start(client) {
for (let num of main) {
client.sendText(`${num}@c.us`, text);
}
}
None of the new contacts got the messages. Please help!!
Also, I noticed it only sends to all contacts that are already chat page. Is there something in the code i need to change?
Edit: Fix typos
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.
We have problem - sulla active, but no new messages come
I installed the library following the steps but when I read the QR nothing happens: it doesn't open a tab on the browser or something.
Im using Windows, there's something else that I need to do to run correctly?
Regards and great work!
when will you do image and sound feature ?
I can't seem to find a function on the Whatsapp.ts that could send images. Is there an alternative way?
Hi, how could I keep running the app after closing the putty window? I executed tmux and sometimes the app does not start and the few times it starts well it does not respond to the messages.
const sulla = require('sulla');
sulla.create().then(client => start(client));
function start(client) {
client.sendText('[email protected]', '👋 Hello from sulla!');
}
How To Compile project not using "npm i sulla". I prefer using "git clone"
making tests to the library has worked correctly and I hope to continue working in this library, my question is if you can send images or video files or other data other than text.
What did I do wrong? This was the code I used.
const sulla = require('sulla');
sulla.create().then(client => start(client));
function start(client) {
client
.getGroupMembers('G7XXXXXXXXXXXXXX')
.then(res => console.log(res))
.then(err => console.log(err));
}
The error
Error: Evaluation failed: TypeError: Cannot read property 'participants' of undefined
See the response given for the python framework here
Will WhatsApp block my number if I use sulla?
I want to know how to do it, seems nice option for groups, its already used in another chat applications
I would like to know how to deploy this project to Heroku, so I can run online.
How to send localization ?
hola como hago que funcione este proyecto solo clonar y instalar
ya que si solo pongo el npm i sulla y lo llamo me ejecuta todo pero entonces es por gusto que clone este proyecto.
como yo puedo ejecutar ese repositorio sin usar npm i sulla ya que es lo mismo y lo envía a node_modules pero no entiendo porque no me coge
Current implementation of loadEarlierMessagesTillDate is
window.WAPI.loadEarlierMessagesTillDate = function (id, lastMessage, done) {
const found = WAPI.getChat(id);
x = function () {
if (found.msgs.models[0].t > lastMessage) {
found.loadEarlierMsgs().then(x);
} else {
done();
}
};
x();
};
This tries to retrieve earlier messages even if the chat doesn't have any, which may cause an infinite loop. The fix would be something in the lines of:
window.WAPI.loadEarlierMessagesTillDate = function (id, lastMessage, done) {
const found = WAPI.getChat(id);
x = function () {
if (found.msgs.models[0].t > lastMessage && !found.msgs.msgLoadState.noEarlierMsgs) {
found.loadEarlierMsgs().then(x);
} else {
done();
}
};
x();
};
⠋ Initializing whatsapp(node:18119) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
/wabot/node_modules/puppeteer/.local-chromium/linux-674921/chrome-linux/chrome: 1: /wabot/node_modules/puppeteer/.local-chromium/linux-674921/chrome-linux/chrome: Syntax error: Unterminated quoted string
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
at onClose (/wabot/node_modules/puppeteer/lib/Launcher.js:349:14)
at Interface.helper.addEventListener (/wabot/node_modules/puppeteer/lib/Launcher.js:338:50)
at emitNone (events.js:111:20)
at Interface.emit (events.js:208:7)
at Interface.close (readline.js:368:8)
at Socket.onend (readline.js:147:10)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
(node:18119) 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:18119) [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.
Im use Ubuntu 16.04 32bit
node v8.16.1
npm 6.11.3
where I must fix it? It's not support 32bit?
The QR code on the terminal is scattered. No QR code reader is able to scan it.
how i cant run multple instance
Hello, Daniel! How are you?
I'm really grateful about the project you've done. I appreciate it.
I have a question: I got a freelancer job, and client would like to use this tool over browser, so I'd need to send QRCode to frontend.
Could you help me out on this issue?
Dear all
I want to build a whatsapp auto responder service.
Whuch user will only will see the qr code to scan from a web page, and after scan i will get his whatsapp name to confirm the connection.
Then in background it has to be a service whuch will connect to the browser via a specific proxy.
This service will take the responsibility to analyze the messages and reply to the sender.
This service will be php services.
I am not sure how can do this since all users here talking about runing the actual browser.
Please understand that i need to have multiple sessions, each one has its own proxy..
I need this to be full automated in background, kind of an API.
How can i achieve this?
Another question : as i understand this library count on analyzing the html and Javascript of whatsapp web platform.
This is very unstable, since whatsapp can update the platform in any time lead to break down this library.
I know that people will figure out a way to get it back but i am talking business wise.
Simeon may say, use whatsapp business api, will it is not available and even if it available, it will be expensive.
Please advice
// import { create, Whatsapp } from 'sulla';
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!');
client.sendText("7895XXXXXX","hello");
}
});
}
This example only demonstrates how to reply to incoming messages but how to send messages without triggering client.onMessage ?
Hola cómo puedo crear un menú y de acuerdo lo que le selección le haga otra pregunta diferente
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.