
Show HN: Whapp-irc – A simple WhatsApp IRC gateway - lieuwex
https://github.com/lieuwex/whapp-irc
======
aclimatt
It looks like this opens a copy of WhatsApp Web and instruments it as its
client. And it uses compiled class names like `._2EZ_m` to interact with the
DOM. Unless I'm missing something, this will probably break weekly or every
time they release a new build of the frontend. Not sure if there's a better
way?

~~~
toxicFork
One alternative is sandboxing the js code (or using existing browser or
networking logging capabilities) to reverse engineer network requests and
write a more raw client instead of piggybacking onto the web client, that
would still have risks of changes but less likely than this.

~~~
est31
> reverse engineer network requests and write a more raw client

People already have done that. The most famous example is the yowsup [1]
python library. The problem with these client implementations is that WhatsApp
is banning any numbers that use them [2]. So most recent attempts to use
WhatsApp outside of the official clients revolve around using WhatsApp Web
somehow. That appears to work better, but even here if you are using it on a
long term basis, WhatsApp might ban you.

Ultimately, WhatsApp is a bad host when it comes to using their service
outside of the official app. This is really sad for people like me who don't
want to install WhatsApp on their phones because it sends too much of my data
to Facebook... probably that's precisely why they are so strict, to get all
the data because that's all they get (the service is gratis after all). That
and spam.

[1]: [https://github.com/tgalal/yowsup](https://github.com/tgalal/yowsup) [2]:
[http://google.com/search?q=yowsup+name+ban](http://google.com/search?q=yowsup+name+ban)

~~~
sopooneo
How can the server component of WhatsApp tell that the client is using the
Python library you mention? If that library implements the protocol correctly,
shouldn't it be indistinguishable from the official web client to the server?

~~~
est31
Creating a _correct_ implementation of a protocol is one thing, creating one
that is _indistinguishable_ from another implementation another. E.g. for
TCP/IP you can find out the OS just from the additional information even
though implementations are correct [1]. I guess they are doing something
similar. And even if your protocol implementation were perfectly
indistinguishable from the other one, usage patterns might reveal differences.
E.g. if you have a bot then bots will most likely reply immediately after you
issue a command. If you add a constant wait time, it's still distinguishable
from humans typing at varying times. Same for uniformly randomly distributed
wait times, I'm sure there is a distinction (I'd say it's correlated to
message length for example). All of this is visible without looking at the
message contents, which are obviously not available to the WhatsApp service.

[1]:
[https://en.wikipedia.org/wiki/TCP/IP_stack_fingerprinting](https://en.wikipedia.org/wiki/TCP/IP_stack_fingerprinting)

------
askthrowaway
My solution was to run WhatsApp in emulator and enable adb over tcp and send
adb commands from server directly to emulator. I automate sending messages and
pdf files from our erp system. and for receiving messages we just have a
Whatsapp web available for one of our employee so he can reply and escalate
whatever.

~~~
octorian
What's a shame here is that the "WhatsApp Business API Client" [1] would
actually be the perfect tool for personal projects like this. Unfortunately,
its still being reserved for use by only larger businesses planning to use it
at scale, so they can be meaningfully paying customers.

Offering low-volume non-customer-facing free access to a product like this
would likely make everyone here quite happy.

[1]: [https://developers.facebook.com/docs/whatsapp/getting-
starte...](https://developers.facebook.com/docs/whatsapp/getting-started/)

~~~
est31
Indeed, it would be great to have something like this for non-business
customers as well. Right now it's very much targeted at large businesses atm
and seems to want a beefy computer, so you can't really install it on your
RPI.

[https://developers.facebook.com/docs/whatsapp/faq](https://developers.facebook.com/docs/whatsapp/faq)

> For single-instance production server setup, we recommend at least 250 GB
> SSD, 16 GB RAM, and 4 core CPU.

[https://www.facebook.com/business/m/whatsapp/business-
api/](https://www.facebook.com/business/m/whatsapp/business-api/)

> In order to ensure a high quality experience for businesses and users, we're
> in a limited public preview. If you'd like to work with us, submit more
> information about your business for consideration as we continue to expand
> our availability.

~~~
octorian
The beefy computer requirements are really just the result of needing to
invent pie-in-the-sky specifications for the website, and wanting to avoid any
bottlenecks when running at high load. Remember, most of the current customers
are trying to actively communicate with an enormous number of contacts.

The truth is that the product does not actually need much RAM, and storage is
a direct function of the number of conversations and messages you're handling
with the product. The main bottleneck is really just I/O for the databases.
For the use cases of everyone here, it absolutely could run on an RPi. Easily.

------
airstrike
Time to finally add a bot to my WhatsApp group chat!

~~~
isoprophlex
My thoughts exactly! What do you recommend in terms of IRC bot building tools?

~~~
baroffoos
There are a whole bunch of tools but you really only want something simple
that gives you an infinite loop that runs every time a message comes in and
gives you access to the current message as an object

------
Arathorn
fwiw, a similar project for bridging WhatsApp into Matrix is
[https://github.com/tulir/mautrix-whatsapp](https://github.com/tulir/mautrix-
whatsapp).

------
coldsauce
why hasn't there been anything like this for iMessage? or any 3rd party
applications at all, really.

~~~
yzb
Is iMessage even a thing outside the US? Everybody in Europe uses WA or
Messenger, at least

~~~
wongarsu
The iPhone has about a 56% market share in the US, compared to a 26% market
share in Europe (with the UK being the outsider with 52% market share).

That makes a huge difference: in Europe it's very unlikely that everyone out
of any group of friends has an iPhone, making Whatsapp, Telegram etc the goto
solutions for group messages.

Apple is also huge in Japan, but I don't know what kind of chat apps are used
there.

~~~
komali2
Line, mostly.

------
chirau
Is there any chance Whatsapp the company will try to take this down and if
they do is there any chance it might survive?

Whatsapp has been notorious for taking down third party APIs and any tools
that allow message automation.

------
rapnie
Very nice project.

I would like to move away from WhatsApp for privacy reasons and out of
principle.

Could I use this to set an auto-reply message to users contacting me,
redirecting them to my new messenger e.g. Signal?

~~~
tomsmeding
If you don't mind having a phone (or emulated phone) being on at all times
running the whatsapp native app, and if you make an IRC bot that automatically
replies to things, yes that's possible.

------
nc
Why did you build this? What are you using it for?

~~~
lieuwex
I wanted to chat using WhatsApp comfortably using my Weechat setup.

------
sam0x17
should call it WhatsIRC

On that point though, what do people think when they see WhatsApp the name? I
get the whole whats up thing, but whenever I see the name I think "What's
App???" as in What is App???

