GithubHelp home page GithubHelp logo

danielcardeenas / sulla Goto Github PK

View Code? Open in Web Editor NEW
1.2K 72.0 270.0 3.16 MB

👩🏻‍🔬 Javascript Whatsapp api library for chatbots

License: MIT License

TypeScript 36.92% JavaScript 63.08%
whatsapp bot framework whatsapp-bot whatsapp-api chatbot

sulla's People

Contributors

arcaela avatar botsup avatar cappp avatar danielcardeenas avatar dependabot-preview[bot] avatar dependabot[bot] avatar greenkeeper[bot] avatar marcelweidum avatar restyled-commits avatar restyled-io[bot] avatar robertslando avatar unknown-consortium avatar zagbutnozig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sulla's Issues

instalación

hola te felicito por tu proyecto.
pero tengo una consulta
no puedo instalar el proyecto ayúdame con los pasos por favor.
image

How can I build/test Sulla

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

sending data other than text

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.

Forward a message

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

qrcode via rest

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?

Developer Project clone

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

WAPI.loadEarlierMessagesTillDate enters infinite loop if the earliest message is posterior to the requested time

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();
};

Decryption (picture, audio) problem

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.

Msgs array is empty

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..

Unable to authenticate user after first QR scan.

After the first time I scan the QR code, the application fails to authenticate my session, starting an endless loop to create a new QR and never continues, making me delete the 'session' folder in order to start it again every time, any help would be appreciated!

Capturar

Nothing happens

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!

Menu

Hola cómo puedo crear un menú y de acuerdo lo que le selección le haga otra pregunta diferente

Error: Failed to launch chrome!

⠋ 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?

How could you send a contact?

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);
		}             
    }
  });
}

Anyway I could send message to new number(Unsaved contact)

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

Error: Cannot find module 'sulla'

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)`

how to install correctly

i followed steps:
install node.js
create instance npm init
install sulla
create index.js
paste code to index.js
run node index.js

error happens, i am missing something but i dont know exactly
image

someone who installed this can help me please? thanks

How to send message

// 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 ?

Start a new conversation

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?

How to Send Messages into a group?

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.

Send message to new contact

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");
  });

Making an auto responder

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

Developer Project

How To Compile project not using "npm i sulla". I prefer using "git clone"

¿How to send messages from "sulla" to a contact?

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.

Send message to a new number?

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.

Trying to get group members id but keep getting error

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

Sulla is getting -1 as ack

Hi!

I just testing this great library but I've a concern regarding ack value in the json response.

It's normal receive -1 as response?

image

any idea?

Get QR Code on a page

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.