mukulhase / WebWhatsapp-Wrapper

An API for sending and receiving messages over web.whatsapp [Working as of 18th May 2018]
https://webwhatsapi.readthedocs.io/en/latest/
MIT License
2.03k stars 796 forks source link

Some general question #112

Closed lddd closed 6 years ago

lddd commented 6 years ago

Hey there,

i would like to know if somebody can explain to me in short how API Providers like APIWHA, WhatsMate, Chat-API and similar are possible to connect a clients own SIM/Number with the WhatsApp Network to use it within there API.

They all provide ways for receiving/sending messages through ne WhatsApp Network. The setup procedure is then mostly the same.

1) You send a message to the API Provider from the device (SIM/Number) you want to register. 2) You get some message back telling you to follow the next steps on there website. 3) Next step is to enter the SMS Code you received by WhatsApp to confirm the device.

After that your device disconnects for that number and you are ready to use the number within the API.

Now as far as i know every client thats wants to connect to either WhatsApp Desktop or WhatsApp Web needs to scan the QR Code before?

So how do they handle this without having the clients device in their own hands for scanning the QR code?

If they do not need to scan for the QR code at all to connect a device, how such "connection" would look like?

I apologize if this might be not the right place here to ask such question but maybe somebody could help.

thanks in advance

sololance commented 6 years ago

Well, this is what are you looking for:

https://github.com/danielcardeenas/whatsapp-framework https://github.com/tgalal/yowsup

chriso0710 commented 6 years ago

Don't waste your time with yowsup or chatapi. IMHO those projects are dead. They are unstable and you will likely get blocked after a few hours. Unless Whatsapp comes out with their own API, your best bet would be to stay inside their infrastructure. This means WhatsappWeb and QRCode.

Just my two cents.

Christian

lddd commented 6 years ago

Chat-Api.com as far as i know and even advertised on there own website is using the WhatsApp Web API as same as APIWHA.com which i am currently testing out but already having problems with like the number i am using (my own SIM/number i registered with the service) randomly seems to hang on processing IN/OUT messages for about 1500 contacts so far.

I don't think WhatsApp will come out with some official API supporting bulk sends very soon. They released "WhatsApp Business" which seems to be promising but as far as i know not built for sending bulk messages, more like a little helper for customers to get in contact with a business.

So in a nutshell, there seems to be no working solution right now? What about whatsbroadcast.com ? They have a lot of larger commercial clients already and i have some friends using it saying its working great, stable and fast. But very expensive. I would already have to sign up for the package of 3k subscribers which is 400 EUR a month.

And all they do i think is splitting a lot of contacts over different broadcast lists created for a clients number and send the message to each broadcast list, right? This way processing is much faster, but do you know what they're using for it? If there is no official API by WhatsApp allowing so?

best regards

chriso0710 commented 6 years ago

I was referring to https://github.com/mgp25/Chat-API, made for PHP. chat-api.com is a different and obviously commercial solution, which shares the name but uses WhatsappWeb and needs the QRCode. Their approach with using a REST API makes sense to me. The team or company behind it is obscure, there is no official company name or address on the website.

I think it would be entirely possible to build something like chat-api.com with this repo. Possible approach: Using the docker API to automatically create a separate docker instance with firefox-selenium for each whatsapp number. And make that available through a http API gateway for client apps.

Regarding Whatsbroadcast.com: Yes, they are well-known and expensive. But as far as I know it is unclear which technology they are working with under the hood. As I am sure Whatsapp does not have an official API they might be doing some "half-legal tricks". I would be very surprised, if they would have access to an unofficial hidden Whatsapp API...

zzet commented 6 years ago

Their approach with using a REST API makes sense to me.

@chriso0710 https://pact-im.github.io/api-doc/ you're welcome :)

lddd commented 6 years ago

https://app.pact.im/signup

No russian here ;)

Otherwise that one looks good, already combining multiple chat messengers. However i would have to test it. What mechanism is used here to connect with WhatsApp Servers, also does it provide a way to send messages to a broadcast list instead of single users messages?

Also: "You will NOT use this API for spam, massive sending, etc."

sololance commented 6 years ago

@lddd looks like parsing web.whatsapp.com https://pact-im.github.io/api-doc/#whatsapp-new-qr-code

Regarding >>

chat-api php api still risky. We didn't send any spam or massive message however our number was banned.

Response by whatsapp: "use only official whatsapp clients"

Number was banned after whatsapp removed support for s40 or changed some protocols while php api is not updated always and developer need days to fix it. So no way we will use it again.

chat-api.com it's a bit risky using their system (anything which is hosted). If one of their customers sends a massive spam whatsapp will block that account and probably will ban any one who shares same ip .

I have asked some questions, they're using virtual containers and for each 10 containers = one shared ipv4. He is also ready to sell his solution for $13500 but who will trust a random six month old site without any company/personal information and fake social accounts?

whatsbroadcast also interesting solution, when you're sign up with them you need to accept to terms which says "If you will be banned whatsapp don't blame us for that". So no guarantees if it will work.

My question regarding custom number usage (because they don't have anything to configure you own number in their panel) in WhatsApp.

Although our platform provide you with a phone number that number is really not relevant to you or your customer and the best way I can clarify this if by having a Skype meeting or phone call.

Looks like this is their business model : if one number will be banned they'll give you new number.


The only solution is currently WebWhatsAPI. It has only one big problem - incoming file downloads instead of thumb downloads.

Whatsapp stores files in blob format, so reading blob url should be enough however how to invoke web.whatsapp.com (maybe with function "forceDownloadMedia" ?) so it will save file to blob and then later parse that.

var reader = new window.FileReader();
reader.readAsDataURL(blob_url);
reader.onloadend = function() {
     save_file(reader.result)
}

This extension should give probably some ideas

https://chrome.google.com/webstore/detail/waboxapp/mgaecjklgnbkkdfnfpncgnogplnjjcdh

zzet commented 6 years ago

looks like parsing web.whatsapp.com

yeah, based on this, but not parsing.

forceDownloadMedia

it will help, but it's not a silver bullet (not working in all cases)

chriso0710 commented 6 years ago

Good summary, @sololance. Fully represents my view on this matter.

So, why not try to build an open source service with containers and a http API gateway, based on the WhatsappWeb API by @mukulhase ? :-)

lddd commented 6 years ago

@sololance

Absolutely agree. Thats why i am currently not willing to pay such monthly fees to a service provider like whatsbroadcast.

But how they able to deal with multiple phone numbers for one client? As far as i know if WhatsApp is blocking the number for what ever reason all your subscribers here would be useless.

Every subscribers here would have to re-register (write to the new number) before they could continue messaging to those... or do i missed something? And for broadcast messages each contact would have to re-add the new number as a contact again.

Regarding the WebWhatsAPI. I don't see problems here regarding incoming messages, also some API heres like the https://pact-im.github.io/api-doc/ mentioned earlier seems to work fine here.

But i can´t see if they also provide a way to send broadcast messages?

zzet commented 6 years ago

"If you will be banned whatsapp don't blame us for that". So no guarantees if it will work.

nobody will give you any guarantees. If you're using such solutions for spam - you'll be banned very fast. If you're using for some automatisation - you can use it for a long time without any bans.

way to send broadcast messages

You'll be surprised, but no difference between sending messages for one contact, or group, or send broadcast messages ;)

sololance commented 6 years ago

@zzet ok, parsing websocket conversation maybe? Like what wabox does?

Regarding "forceDownloadMedia", do you have any workarounds that you can share/commit to this repo? That would be great for all of us.

I have never used it for spamming. So no problems with that. However putting whatsapp number on a risk for being banned is not a solution.

@chriso0710 yes, I would like to contribute however first of all this api needs some improvements for file downloads and some documentation/examples, then it will be useful everywhere for everyone.

I will try to help and contribute but it takes time sadly to sit and understand from start :(

chriso0710 commented 6 years ago

however first of all this api needs some improvements for file downloads and some documentation/examples, then it will be useful everywhere for everyone.

Agreed. Although I think it would be great to have something working for receiving and sending just simple text messages. That would mostly cover my main use case. Media messages (downloads) could be implemented after that.

lddd commented 6 years ago

You'll be surprised, but no difference between sending messages for one contact, or group, or send broadcast messages ;)

Its a big different. All APIs I´ve tested so far sending messages to single contacts which can take up to 30 seconds or even longer for 1 message. Its all processed successively as long as you not send your message over a dozens of different numbers to split the amount.

That means sending 1.000 messages will take up to 500 Minutes already. The information sent will be outdated before even seen by 10% which is a nightmare for any serious marketing campaign.

Sending a message to a broadcast list instead would allow sending that same message to at least 256 AT ONCE. So this message would be delivered probably in a few seconds to every recipients device because its processed by WhatsApp it self.

So i also cannot understand why all these API providers no matter if commercial or found on Github prohibit bulk mailing, according to their own statements.

I mean bulk sending does not mean it has to be SPAM. Its a completely different thing if people want to get the information and signup for it by sending a message to your number first.

I am just looking for something that is able to to do FAST enough. I mean most of the things tested so far even have problems with single replies (for e.g if you plan a chat bot or quick auto replies) in most times it takes up to 30 seconds or much longer.

Now would you want to wait for a chat bot hours in front of your screen to get some stupid reply?...

zzet commented 6 years ago

@lddd I told about technical difference. If you have prepared broadcast lists - no problem to sent messages in this lists (checked 5 mins ago).

lddd commented 6 years ago

@lddd I told about technical difference. If you have prepared broadcast lists - no problem to sent messages in this lists (checked 5 mins ago).

Setting up some broadcast lists first would be not a big deal. But what API now you are talking about able to do so? I am little confused by all the things tested today again, so sorry for that :)

lddd commented 6 years ago

All APIs tested so far are horrible. Support awesome slow or not working as promised. Think i am going to wait until there is something official released by WhatsApp.

Seems like every unofficial API approach right now requires to have the phone connected through QR and keeping the device online? Now that sucks...

sh4dowb commented 6 years ago

I used yowsup to register and send only one message. next day, my number was banned lol.

lddd commented 6 years ago

Hey guys i am still trying to find a solution. Can anyone explain to me if services like WhatsBroadcast maybe using multiple WA Channels to realize bulk sending to their clients? I am not exactly sure how such channels are used for this purpose. From my understanding so far each "channel" is just a real or virtual SIM/Number right?

So how do newsletter subscribers are reached by the same sender saved to the subscribers contact list if they use multiple numbers for sending?

Regarding the WebWhatsAPI python script here

So if it provides a way to send messages to broadcast lists but those are limited to 256 numbers as far as i know.

Is there some automatic way to attach all contacts for my number to multiple broadcast lists and send the same message to each of them?

lddd commented 6 years ago

All sleeping?

Anyone can tell me if its possible to scan a web.whatsapp.com QR as file to activate it instead having to use the phones camera? If not somehow possible to connect to whatsapp web with whatsapp running inside a emulated android device?

chriso0710 commented 6 years ago

I do not think it is possible to use web.whatsapp.com without a real phone, which is connected to Whatsapp. Whatsapp is doing all kinds of stuff to protect and secure their infrastructure. They are actively detecting and blocking 3rd party clients (and the numbers). So IMHO all clients, which do not use the "official" way of web.whatsapp.com are going to fail or at least will become unstable any time.

(I had a Whatsapp receiver made with yowsup working for a few months as part of a commercial project. But it was a struggle and never stable and it soon became clear to me that it is impossible to keep up with Whatsapps changes and aggressive detection mechanism).

konanBakkar commented 6 years ago

What about https://vixi.io/ "The Only Business Solution for WhatsApp Around The Globe" they seem to be doing it legally.

lddd commented 6 years ago
What about https://vixi.io/ "The Only Business Solution for WhatsApp Around The Globe"
they seem to be doing it legally.

There is nothing special with them. There are already dozens of services like that. Also there is nothing "illegal" at all with using WhatsApp programmatically. They just do not offer any public API thats why we are here...

lddd commented 6 years ago

I do not think it is possible to use web.whatsapp.com without a real phone, which is connected to Whatsapp.

I think you could use some android emulator to run WhatsApp inside a virtualized "real device" possible manipulate the camera input by using something like https://github.com/umlaeute/v4l2loopback and replace the video source with the desktop screen of the emulated device. This should work but not tested yet.