Send WhatsApp messages via PHP using WhatsAPI
I recently discovered that once you have acquired your WhatsApp account password, it’s relatively easy to send and receive WhatsApp messages via PHP. Using the PHP-based framework WhatsAPI, a simple WhatsApp notifier script only has a dozen lines of code.
This tiny tutorial shows how to use the two very basic functions of WhatsAPI, namely to send simple outgoing messages to any number and to listen for new incoming messages from your own WhatsApp account. This is the second part of a two-part tutorial. The first part demonstrated how to sniff the WhatsApp password from your Android phone or iPhone.
Contents
Updates
- December 2013: I kindly ask you to stop e-mailing me about hacking into WhatsApp accounts or sniffing WhatsApp passwords for you. Also, I will not help you to send mass WhatsApp messages – even for money. Thank you!
- February 2014: WhatsAPI is down (DCMA infrigement), so using it would be highly questionable — if not illegal. Whether it still works or not: I don’t know. Also: I do not know where to find the latest code.
1. Get your WhatsApp password
This little demonstration only works if you have already obtained your WhatsApp password. If you have not and have no idea how to do it, please check out the first part of this tutorial.
2. Get WhatsAPI and send/receive messages
Assuming you have your WhatsApp password at hand, let’s see how easy the usage of WhatsAPI is.
2.1. Download WhatsAPI and test scripts
Downloading WhatsAPI is really simply since it is hosted on Github. Simply make a new directory and retrieve WhatsAPI from Github.
1 2 3 4 |
mkdir whatsapp cd whatsapp sudo apt-get install git git clone https://github.com/venomous0x/WhatsAPI |
Once you have done that, you can check out the current structure of the project. There is also a file called EXAMPLES.php (was at https://github.com/venomous0x/WhatsAPI/blob/master/src/php/EXAMPLES.php, site now defunct, July 2019) that shows a few more examples.
I also prepared a few small scripts that you can use as a basis to make your own scripts:
- whatsapp_whatsapi_send.php is a command line script to send any strings to a given number.
- whatsapp_whatsapi_listen.php listens for incoming messages and outputs them to STDOUT.
- whatsapp_whatsapi_config.php defines the configuration (source/destination numbers and WhatsApp password) for the send/listen scripts
- whatsapp_whatsapi_example_messages.txt shows the structure of a few WhatsApp messages (print_r($msgs) output).
To download my two minimal examples, run the following commands, and edit the file whatsapp_whatsapi_config.php to set your own user credentials:
1 2 3 4 5 6 |
wget -O whatsapp_whatsapi_send.php http://blog.philippheckel.com/uploads/2013/07/whatsapp_whatsapi_send.php.txt wget -O whatsapp_whatsapi_listen.php http://blog.philippheckel.com/uploads/2013/07/whatsapp_whatsapi_listen.php.txt wget -O whatsapp_whatsapi_config.php http://blog.philippheckel.com/uploads/2013/07/whatsapp_whatsapi_config.php.txt wget -O whatsapp_whatsapi_example_messages.txt http://blog.philippheckel.com/uploads/2013/07/whatsapp_whatsapi_example_messages.txt chmod +x *.php vi whatsapp_whatsapi_config.php |
2.2. Send WhatsApp messages
As you might know from your smartphone client, you can send different kind of messages through WhatsApp: Besides text, you can send audio and video files, locations and contacts. WhatsAPI can do all of those things in just one line of code.
My simple sample script whatsapp_whatsapi_send.php just shows how to send a regular text message. The script is meant to be called by the command line, but the code can also be used in a web application:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#!/usr/bin/php <!--?php require_once('whatsapp_whatsapi_config.php'); $destinationPhone = '495553333333'; $w = new WhatsProt($userPhone, $userIdentity, $userName, $debug); $w--->Connect(); $w->LoginWithPassword($password); $w->Message($destinationPhone, $argv[1]); ?> |
The script includes the configuration for your WhatsApp username, password and display name. It’s very easy to use and quite self-explanatory: The WhatsProt class is the only thing you need. Simple Connect to the WhatsApp servers and LoginWithPassword to authenticate yourself. After that, you can use the following methods:
- Message($to, $msg): Simply send a regular text message to $to.
- MessageImage($to, $imageURI): Send images by URL or local path (jpg) to $to.
- MessageVideo($to, $videoURI): Send videos by URL or local path (mp4) to $to.
- MessageAudio($to, $audioURI): Send audios by URL or local path (mp3) to $to.
- Location($to, $lng, $lat): Send GPS coordinates to $to
- vCard($to, $vCardName, $vCard): Send a vCard to $to.
- WaitForReceipt(): Wait for the WhatsApp servers to confirm the delivery.
The tiny script from above obviously only sends plain text messages. You can use it from the command line like this:
1 |
./whatsapp_whatsapi_send.php "Warning: CPU temperature at 65°C" |
The script is particularly useful as a WhatsApp notifier, allowing you to receive notifications from your servers whenever you want — for example, if the CPU temperature rises above a certain threshold, the load is too high for a certain amount of time or one of your scripts failed/succeeded. This is particularly interesting in combination with a system monitoring service such as Nagios or Monit.
2.3. Receive WhatsApp messages
To be able to receive WhatsApp messages using PHP, you need to listen for new messages. WhatsAPI’s PollMessages does exactly that. It reads messages from the WhatsApp server socket and puts them in a local queue for processing. The method blocks if there are no messages and waits for the server to send a message indefinitely — just like any other server does. Using GetMessages you can pull the messages from the queue and process them in your application.
A minimal script would look very similar to the example from above, except that instead of calling Message(), you need to call PollMessages() and GetMessages() in a server loop:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<!--?php require_once('whatsapp_whatsapi_config.php'); $w = new WhatsProt($userPhone, $userIdentity, $userName, $debug); $w--->Connect(); $w->LoginWithPassword($password); while (true) { $w->PollMessages(); $msgs = $w->GetMessages(); // Do something with the messages ... } ?> |
Each WhatsApp message has a set of standard attributes ($m->_attributeHash) such as from (sender number) or t (send timestamp). Additionally, it has different kind of child nodes that contain additional/optional information, depending on what type of message it is: a notify child node, for instance, tells the conversation partner that he or she is online and still writing, and the body child node contains the text contents. There are many more of these. You can see for yourself by calling print_r($msgs).
The following snippet shows an excerpt of one message — refer to this example output to see more:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
ProtocolNode Object ( [_tag] => message [_attributeHash] => Array ( [from] => 491231234567@s.whatsapp.net [id] => 1373204559-6 [type] => chat [t] => 1373205620 ) [_children] => Array ( ... [2] => ProtocolNode Object ( [_tag] => body ... [_children] => [_data] => Hallo blog readers ) ) [_data] => ) |
My example server script whatsapp_whatsapi_listen.php extends the above snippet and processes the messages like this: It takes the time (t) and sender number (from) from $m->_attributeHash and the name and _data from the child nodes. Each non-empty message is printed to STDOUT, like this:
1 2 3 4 |
./whatsapp_whatsapi_listen.php [07/07/2013 15:57] From: 491231234567, Name: Philipp, Message: Hallo blog readers [07/07/2013 15:57] From: 491231234567, Name: Philipp, Message: Everything I write is printed to STDOUT [07/07/2013 15:57] From: 491231234567, Name: Philipp, Message: Exit |
If the message body is “exit”, the script exits.
That’s it. I hope this tutorial helped a little in understanding how WhatsAPI works. If you have any suggestions or questions, please let me know in the comments.
Hello Philipp,
This is really interesting and very comprehensive, though I actually haven’t tried it myself. But tell me, is it possible to have a piece of code which would have the same functionality as this, but in VB.net? Or rather, if you don’t have or can’t suggest me any vb.net code, is it possible to run php scripts silently on a server? Thank you.
Regards,
Matsoso Seboka
Hello Matsoso,
well the code uses a PHP-based framework, so unless there is a .NET library to do that, I believe you cannot simply translate it to VB.net.
What do you mean by silently? You can of course run them on the command line (see script above) or by calling an URL. If you have a server with PHP installed, you could place a notifier script at http://example.com/whatsapp_notifier.php and call it from the VB.net program like this: http://example.com/whatsapp_notifier.php?to=49123456789&msg=Hi+there+this+is+a+Test
Hope this helps,
Philipp
hello philipp i have just seen your script and this is nice i m working on a whats app like chat app i m using php mysql json technology how can i used this script in my application..
Well you can certainly use this script in this type of application — but I think you have to figure out how for yourself.
Check out this application first, it’s something similar to what you want to do and it’s part of the WhatsAPI code: https://github.com/venomous0x/WhatsAPI/tree/master/src/php/ajaxDemo
Hi Sir,
hope so doing well !
i have downloaded , whatsapi , but i want to run this to my web portal , will you give me idea sir
we want to create web portal , there user can send message to his whatsup friends .
so, please give me idea , how to implemented to my web portal .
Thanks
Deepak goud
Hi Philipp, Where do you get the variable $userIdentity ?
I probably should have mentioned that somewhere. $userIdentity is the IMEI of the device. You can find it in your device in Settings / About device / Status.
Hellp Phillip
Please i want any Tutorial video or a php website to test it ?
Hi Phillip,
Can you send the demo for this api??? Its not working
They recently changed the function names of the WhatsProt class. The methods still exist, they just have different names. Check out the new names here: https://github.com/venomous0x/WhatsAPI/blob/master/src/php/whatsprot.class.php
From what I can see (without testing), here are the new names:
Not able to get the password after Restore messages. I think whats app done some encryption method. Please help me …..
Hello, how to sniff the password which will be created by whatsapp?
We want to incorporate this in an app but was wondering about the legalities. Any thoughts on that?
I am pretty sure that there is nothing illegal about using WhatsAPI. However, I have heard of instances where WhatsApp accounts have been locked. I don’t use it with my regular number anymore, because I am afraid they will lock my account for good. Keep that in mind.
Hi Philipp
Is it possible to translate to java code?
I really need it
What is the $userIdentity? Or how I can get it from my phone?
Many thanks in advance!
Please refer to this comment: http://blog.philippheckel.com/2013/07/07/send-whatsapp-messages-via-php-script-using-whatsapi/#comment-35244
Thanks! For Iphone it is the WLAN-MAC, right? How to get the password? I just used for iphone $iphoneWhatsAppPassword = md5($myWlanMAC.$myWlanMAC); or android $androidWhatsAppPassword = md5(strrev($myImei)); . Is it still the common way?
Iam getting:
rx
rx
rx
—
Setting:
$userPhone = ‘490176xxxxxxx’;
$userIdentity = ‘XX:XX:XX:XX:XX:XX’;
$userName = ‘Test’;
$password = ‘di2349dsjkdfj239230sdk39203dj3923e’;
Just saw: http://blog.philippheckel.com/2013/07/05/how-to-sniff-the-whatsapp-password-from-your-android-phone-or-iphone/ .
hi can i use this to incept / send whatsapp messages from a blackberry phone
if i have the IMEI no and password?
Dear Philipp
hi, I am very interest to integrate this feature into my php, do you help for setup this with services charges? please contact me, thanks a lot, roderisland[a]hotmail.com
Hi All,
I am keen with this just my problem is that I would prefer to send it via my java application is that a problem ? So should I call it as an url and send the parameters? Secondly I am using centos how will the setup differ?
this don’t work anymore, whats app implements his own private DNS and ssl code in his apk, so you cannot get your id password :(
That’s unfortunately true. I have mentioned that in the first part of this tutorial: http://blog.philippheckel.com/2013/07/05/how-to-sniff-the-whatsapp-password-from-your-android-phone-or-iphone/#Updates
Hi Philipp,
is there any possibility to create a password for a BlackBerry Q10?
Didn’t find anythin, hope you can help me.
Thanks
George
Thanks for your posts.
The method Message doesn’t exist now. You need replace to sendMessage.
They changed the API a few times already …
Ha! And we’ll do it again! >:D
We’ve updated the Wiki though!
:-D
Is it possible to get password through API if android was blocked?
hi,
is possible send a push notify whatsapp by Email ?
i want to send an email to see a push whatsapp notify, is possible ?
thank’s
Great script, tanks for share this script and tutorial works for me.
Hi, is there any posibility to find out the password after WhatsApp did the changes? Is the script still useful?
To be honest, I am not sure if you can get the password nowadays. I haven’t tested it.
ok thanks. are there any other messaging services for e.g. iOS and Android which have a PHP interface? I Just want to send messages to dedicated devices without using SMS
Hi,
Thanks for the good work.
Have you heard any thing like whatsApp changes password after certain time?
For us script is working fine for few days. After that it says authentication fails. If we get new whatsapp password for same number it starts working again.
Hi, I am interested in put a server to receive messages from users with whatsApp but how stable is it? in your knowing how often then change the API and get the services off?
Hi Philipp.
first congratulation for your great blog
I try your code for listen messages and I have a PHP error:
PHP Notice: Undefined property: ProtocolNode::$_attributeHash in /home/test/whatsapi_listen.php on line 18
The standard attributes _attibutesHash & _children that you describe in section 2.3, are different:
[0] => ProtocolNode Object
(
[tag:ProtocolNode:private] => message
[attributeHash:ProtocolNode:private] => Array
(
[from] => xxxxxxxxx@s.whatsapp.net
[id] => yyyyyyyyyy-zzz
[type] => chat
[t] => aaaaaaaaaaa
)
[children:ProtocolNode:private] => Array
……………
…………….
How I can access to these attributes in PHP code?
have you modified the code of your server script for listen
Thanks in advance.
@Johnny: It’s not stable and not permitted by WhatsApp. So I wouldn’t do it :-)
@Sachin: People get blocked regularly. Sometimes indefinitely. Be very careful how many messages you send.
@JeReC: WhatsAPI changed their API/methods a couple of times. Check out their site to find that out. I cannot do support for WhatsAPI here. I hope you understand.
Hey!
Did somebody find out how to get the password? :) I heared they updated it, so I can’t get it with the explained way..
But I really want to do some kind of a bot with it to practice.
Can you please describe how to configure status text for whatsapp with api.
hi Philipp,
I found the contactsync.php can not working now, when I use the contacts.php it can’t get the mobile who use the whatsapp, can you check it?
I am willing to do it for my blackberry phone. Where from i could get the password for whatsapp? I searched in google i dont know where to look for this. Can u help me in this case ?
hi, had install your whats app script and it work fine in send text message, but i face 2 problems
1) when i send image i got Ajax time out message
2) when i send video its dose not display video
Hi Philip
Is there a way to know the nick name of a user using their phone number?
hi .i had install your whats app script but the receiver not receive the message ?
2 – whats is the id in whatsapp.php file ?
hello there i get this error
Error: There was an error with the AJAX request. HTTP Error (500 Internal Server Error) .Internal Server Error
well i try the src any update??
hello mr….
how can i get outgoing messages????
help me please!!!!
thanks
Where should I find password for API. b’cze as I know & get research there is no password facility in whatsapp mobile phone. Please provide solution.
Hello everyone;
i have a couple of questions
1- i tried to download the api but the site is saying it has been taken-down, anyone has it?
2- is the API Still working
thanks for your help
The API is down (DCMA infrigement), so using it would be highly questionable. Whether it still works or not: I don’t know.
Hello sir
I am not able to download file from specified URl https://github.com/venomous0x/WhatsAPI could you please tell me how can i download it
Hey,
Since WhatsApp API has been removed, can you please provide me with it’s zip or something?
Thanks
After the removal of WhatsAPP due to DMCA is there anyway that i can interact with WhatsAPP ?
Hi philip thank you
But i trtrying to run the listen it says ,i can’t found this class RawPacket.
Hi,
I am not able to find the WhatsApp API setup compatible with my device.Please help me get it.Any help would be appreciated.
When I click for API it shows this “Repository unavailable due to DMCA takedown”
I try this way but not work
any help ??
dear friends…
this is the code
#!/usr/bin/php
Connect();
$w->LoginWithPassword($password);
$w->Message($destinationPhone, $argv[1]);
?>
but i couldnot find “whatsapp_whatsapi_config.php” file in whatdsapp github file
Hello Sir.
I want to Incorporate the Live Chat.(Watsapp), in my website. Shall the above article
help me?
Please reply as soon as possible.
Waiting your reply.
Thank you.
Hello Sir
I studied the following article. i.e (How To: Sniff the WhatsApp password from your Android phone or iPhone).
But i’m unable to do the following step. i.e (Set up and run mitmproxy and prep you phone (as described in this tutorial).
It would be better if you provide a video tutorial for this step.
Secondly, if you provide a demo whatsapp password, so that i can get an idea of how it;s working.
Hi,
Can you advise me how to send the html message through the API.
Regards,
Vinoth
Hi,
Your tutorial will helped me a lot. i have a query, how to send the a href link messages.
Regards,
Vinoth
Sir . I want to mack a web site in php and i want to use whatsapp in my site . And i want to use whatsapp full facility like create groups add contact and many more in my website how can i do this.
Bitte geben Sie diesen Kommentar frei Herr Heckel. Denken Sie daran: »Die Daten müssen fließen.«
Spamming is amateur stuff. Simply write a shell-script for e.g. named »./wa-api-snd-auto.sh«:
#!/usr/bin/env bash
echo “Creator »TRON-DELTA.ORG« & License »TDOL«”
echo “”; LC_ALL=C TZ=:/etc/localtime date +”%a %b. %d, Y%Y · %r [%zh]”;
while [TRUE]
do
./whatsapp_whatsapi_send.php “SPAMTEXT”
# Consider altering $destinationPhone in
# »whatsapp_whatsapi_send.php« by using $argv[2].
# 0 = whatsapp_whatsapi_send.php
# 1 = SPAMTEXT,
# 2 = TARGETNUMBER.
# Of course one can add more parameters if needed.
sleep 1s
# You may want to circumvent WA spam detection by using
# higher values.
done
I know he script above is so lame, but does the job I assume. By the way the WhatsApp API is available elsewhere.
Original/Generic: github.com/shirioko/WhatsAPI
C# w/ Windows: github.com/shirioko/WhatsAPINet
Have fun! :]
So far we have the new API and a SPAM script. The final questions people stated were related to stealing passwords and hacking accounts. To some people’s surprise that is achievable too.
In LAN environments one should set up a hotspot, let people connect to it and run a proxy there to intercept messages in transit (MITM attack) – also think about the TLS pinning problem here. That system may run GNU/Linux and a software similar to mitmproxy. There is also proxy software available for prefab’ed GNU/Linux distributions, like for e.g. DD-WRT. Look up a list on Wikipedia. In case people won’t use a WiFi (WLAN) network, setting up a cell tower and making devices register with it is advised. That may sound hard but there is already equipment for this around on the internet. One may have to look hard to find it!
In case the aforementioned is not an option, remote interception is the only way to go. The problem is of course to identify targets and gather phone numbers. However there are projects on the web which allow reverse lookups of numbers by providing user names. That’s an advantage since names are easier to guess/gather oftentimes. That enables other kinds of attack vectors – assuming weak passwords and security unaware users. In case a fast and direct interception is a requirement an attacker should consider war driving and combine that with the cell tower option above or for e.g. impersonate Starbucks WiFi. In the case of the CT option a forceful shutdown of a given smart phone is likely going to be necessary to enforce a sign on. In that case either social engineering or a direct attack on the person/persons phone is a fast but violent approach. To sum it all up one can say an attack with OSINT, SIGINT and HUMINT taken into account would indeed be the most promising approach.
I was wondering, since they don’t use the IMEI anymore, what should my identity be then?
I have register my Number using Yowsup CLI and using that password to send Text message but my number getting block after 50 messages can any help me out for this
Hello!
Every time I send messages through the API
They block me after a few posts, is there a way that they do not block the posting?
Please!!!
Dear Guys
I would like to send HTTP link such as www.google.com to destination user
the user will get the message as link to website, and be able to click on it and be ddirectly forworded to browser .
at the moment i am geting it as message (pute text)
How to implement for send to group
Hello Sir .. Thanks for your post ..
Is it possible, for example, send messages to many destinations?
For example, is it possible send messages for a WhatsApp group?
Thanks for your help!!
I wonder how do I treat what I get in debug, for example listen, tried to do what is written, the more I get a lot of errors, wanted to leave the response to training. Most can not, will treat as xml solves?
I get these errors:
Notice: Undefined property: ProtocolNode :: $ _attributeHash in C: \ xampp \ htdocs \ whats \ public \ whats4 \ whatsapp_whatsapi_send.php on line 20
Notice: Undefined property: ProtocolNode :: $ _attributeHash in C: \ xampp \ htdocs \ whats \ public \ whats4 \ whatsapp_whatsapi_send.php on line 21
Notice: Undefined property: ProtocolNode :: $ _children in C: \ xampp \ htdocs \ whats \ public \ whats4 \ whatsapp_whatsapi_send.php on line 25
Warning: Invalid argument supplied for foreach () in C: \ xampp \ htdocs \ whats \ public \ whats4 \ whatsapp_whatsapi_send.php on line 25
Hello guys i have a big problem, I tried several times to do what you and this forum also others, but the error is that I entered is the one below.
Fatal error: Uncaught exception ‘Exception’ with message ‘Login Failure’ in /var/www/html/WhatsAPI/src/whatsprot.class.php:1655 Stack trace: #0 /var/www/html/WhatsAPI/src/whatsprot.class.php(475): WhatsProt->doLogin() #1 /var/www/html/whatsapp_whatsapi_send.php(8): WhatsProt->loginWithPassword(‘ZXNn7dEAd8hS0T3…’) #2 {main} thrown in /var/www/html/WhatsAPI/src/whatsprot.class.php on line 1655
Hello guys, im trying to send image/audio/video with my WhatsAPI, but sometimes the server upload the file but didn’t send it, someone know how can i fix this? Thanks guys..
Whatsapp always block the number after arround 20 messages…. in this case what is the point of this work??? is there any way to prevent the block?
Hi Philipp,
Thanks for this useful website, I was managed to use this to send whatsapp message albeit not knowing how long whatsapp API can be used. I have a simple question to ask you, whether possible or not, for picture sent to whatsapp can be received as image file (can be jpeg). I google over net, mostly describing how on to receive text message only.
I have requirement to save picture into my backend application for every picture sent to whatsapp number which monitored by whatsapp api.
For those who are having some experience in this aspects, appreciate can share your thoughts here.
Thanks in advance
Eric
Hi Philip,
Is the IMEI required?
I get my WhatsApp Password over my Tablet. And This have no IMEI.
The API says me “Success: Message send”.
But the Message does not come on.
I Hope You can Help me.
Sorry for my bad Englisch, i am German ;)
Thanks
hello sir,
thanks.this app working very well on my desktop. now i want to know, is there any way to check other number exists on whatsApp or not?
how to check this?
please let me inform…
I am Not able to get Password , I am Using Windows 8.
Hi, Can you send me the script code ready made download which works perfect?
I want to use it.
Can you send me the Github link to download this scripts or send me on my mail address please?
Thanks.
how to store recived messages and numbers in variable to store messages in our database
Hello Philipp,
Is there a way to get the phone number via whatsapp? I have my mac adress and IMEI but the phone got stolen. If there is a way to know the phonenumber of the person who uses whatsapp on my phone, it is a step closer to finding the thief. I would really appriciate it if you could look in to it.
Thank you,
Anthony
Hello Philipp,
OK, I working on an application trying to send invitations to user contacts over WhatsApp so scenario will be as follow.
– User will open invite screen.
– Screen open filled with his contacts
– Each contact marked if he is whatsapp user or not (Is it Applicable)
– when user select X from his contacts to send them invitations
– Client will send contacts details to the server
– Server will send to those contacts a whatsapp message (Is it applicable)
Note: regarding password what I understand is that password different for each user so how can I get the whatsapp password for each user using my application.
Thanks
Hi there! until august 22th, this api was working properly, but sice last night I don’t receive any messages, and no changes on my code have been done.
Do I need to get the password again?
Is there any way to debug the responses of whatsapp server?
Hello, i want to create a app in vb, can i use whatsapp in this project? Or another way, htt for example, thanks.
Hi,
Thanks for your great tutorials,
any one can help- how to store our personal contact for group post and how to see already sent post????
thanks in advance.
Abhishek Jha
Hi Phillip
I have seen the AP in php in action… is there a way to make it work in Javascript? I am trying to receive messages from users only. I have not quite yet understand how to implement Phyton on a windows server.
Regards!
Hi Philipp.
Have you a link to test this solution?
Thank you.
nice use of whatsapp API. this technique can be used to save text message cost. Thanks for sharing.
hai philipp, i really appreciate with this WhatsAPI. But in my office, we use proxy for internet connection. And when i try to use this WhatsAPI, its getting error. But when I use my phone as personal hotspot, its running well.
Would you like to tell me, what should i do whit WhatsAPI when i want use proxy. So it can running on computer with proxy internet inside.
thanks
Hello sir
I am the php developer and implement this whatsapp api for send bulk sms script. but i have an issue. when i register my number with whatsup api then it logout in my device. and when i use in my device (same number) then i again verify my number in my
device. and if i use in my php api then i again register my number with api. Please tell me the solution so not register again and again in api and
device.
Also please tell me that how many sms we send in bulk from bulk.php at a time. and how long time this api runs in future.
Please reply as soon as posible.
Thank you
Saurabh
I want this software of bulk whatsapp
please if any 1 cn provid me then
mail me yash.rspd@gmail.com
Congratulation Philipp for your great work, I successfully run the API, it’s working very well,
but one thing how to check status online/ofline or last online date/time,
i tried many time by using onPresenceReceived( ) function but not getting any thing
please help me.
whatsapp blocked my number after sending 20+ messages,is there any way to use this api effectively?any suggestions?
Hi Philipp,
There is an extension for Opencart web sites lets you to share products with your friends by whats app.
http://www.opencart.com/index.php?route=extension/extension/info&extension_id=18638&filter_search=whatsapp
Can it be converted to a chat extension like Zopim chat?
I mean when a customer entered to website “by mobile” it will appear like Zopim chat and if customer want to ask something and push the button, he will redirected to representative on line on whatsapp chat?
Is it possible for customers just by clicking the icon button it will automatically add representative’s number to customers contacts (ex: by asking for permission, etc.) and can directly type to representative on whatsapp?
Can you do this adjustment? And how much will it cost?
Pls. see below dropbox link for example screenshot.
https://www.dropbox.com/s/ovuzsq4dj6ilb2i/whatsapp%20chat.jpg?dl=0
Best Regard.
Gokhan Gokce
Quick question, when set up to receive whatsapp messages (via script), would it continue to be possible to receive the same messages on the mobile phone?
Hi Philipp, great tutorial.
Do you know of anything in the API that can help me change my status on whatsapp. I have been trying to achieve this for long. Say everytime I connect to my home wifi, llama or tasker update my status to “At Home”. Since there is no API available to tasker it can’t do it directly. But I can have it flip a php switch,
Actually, i’m looking for trick on how to receive other people message and automatically sent them into my specific WhatsApp folder or group. Is there any script to make this happen?
Hello phillip
is there any api that we can use for image + caption text share using iphone
I can share either of that
Thanks
Hi there
Can you please make a video presentation or tutorial for this.
Hi.
Thanks for this tutorial. Please note that I believe WhatsApi now wants you to use methods to address the contents. So looking at your listenere, it says now:
foreach ($m->_children as $child) {
if ($child->_tag == “body”) {
$body = $child->_data;
}
Which has become:
$text = $m->getChild(‘body’);
$body = $text->getData();
One thing I haven’t figured out yet is why the listener after a short while does not listen anymore…
How we send arabic language text message through api.
like this : هذا هو بعث برسالة العربية .
I make a script which send english message but when i send arabic language then it show “????????” in receiver end.
Please tell me this is urgent.
Philipp, you have a demonstration online this project?
Thanks!
hi.. does above tutorial still working?
Hello. Is it possible that we can get images/pictures using this WhatsAPI?
You have not mentioned in your posting and I need to get images from WhatsApp.
Thanks in advance!
Array ( [method] => sms [in] => 9714568445 [cc] => 91 [id] => %da9%a3%ee%5ekk%0d2u%bf%ef%95%60%18%90%af%d8%07%09 [lg] => hi [lc] => IN [token] => iXLR4VCJ2DZI6hh46REw3EKpzT4%3D [sim_mcc] => 000 [sim_mnc] => 000 ) stdClass Object ( [status] => fail [reason] => old_version )
what can i do
when i am calling to exampleregister.php it shows me this:
Array ( [method] => sms [in] => 9714568445 [cc] => 91 [id] => %da9%a3%ee%5ekk%0d2u%bf%ef%95%60%18%90%af%d8%07%09 [lg] => hi [lc] => IN [token] => iXLR4VCJ2DZI6hh46REw3EKpzT4%3D [sim_mcc] => 000 [sim_mnc] => 000 ) stdClass Object ( [status] => fail [reason] => old_version )
what can i do
You could sell some consulting hours so that my company can use the API WhatsApp .. ??
Tks.
Hi ,
First please tell me which file is run. I have run whatsapp.php but all cretintial error show. Please give me suggestion.
hi
i can’t connect to whatsapp i us:
useridentity : $myIME
password: md5(strv(useridentity)
but its show the msg “Login Failure”
can you help me plaise
Thanks, Phillips.
Will you suggest on how to send simple text to whatsapp group?
$userPhone = ‘490176xxxxxxx’;
$userIdentity = ‘XX:XX:XX:XX:XX:XX’;
$userName = ‘Test’;
$password = ‘di2349dsjkdfj239230sdk39203dj3923e’;
please give me details above this
hi.. does this tutorial still working?
hi,
can u possible to send sms without whatsapp password? if yes so how?
.. you have done a very good job.. I am interested in sending an alert from my computer to my phone for whatsapp .. can you tell me if even his method works. thx. ml.tecnoventas@gmail.com
how we can send WhatsApp messages?
hi,
i have tried as per your article, but i am getting following fatal error ( ‘Login Failure’ exception )
Fatal error: Uncaught exception ‘Exception’ with message ‘Login Failure’ in …..src/whatsprot.class.php:1640 Stack trace: #0 ../src/whatsprot.class.php(474): WhatsProt->doLogin() #1 ../examples/exampleFunctional.php(109): WhatsProt->loginWithPassword(‘3w5OwL4nvjbDqK5…’) #2 {main} thrown in ../src/whatsprot.class.php on line 1640
Will you please suggest to resolve this issue…..?
Hi guys, is there any other up to date article talking about this?
Hi!
Error: There was an error with the AJAX request. HTTP Error (500 Internal Server Error) .Internal Server Error
I am sending messages but when i send a link it is also in text. I want to know how i can send the link
The github page you posted isn’t working please share the code and send again
hi i want you help,
how to send message in whatsapp group using php?
i can understand we need group id.
but i dont know how to find group id please tell me…i want very urgent
Thank you
when i am calling to exampleregister.php it shows me this:
Array ( [in] => 99****** [cc] => 91 [id] => �d�oh/q���� ]ƻ�� [lg] => hi [lc] => IN [sim_mcc] => 404 [sim_mnc] => 000 [method] => sms [token] => 4c0e62c3434af19fc3757519c66f2acc ) stdClass Object ( [status] => fail [reason] => old_version )
Hiii ,how to get whatsup password
Dear Philip,
Is it possible to send PDF files? Then what is the funcation and what are the parameters to it?
How to receive the last reply ?
Can you please give me a small segment of code explaining this?
Dear Philipp,
Please can you assist me with a little script that can effectivelly send/receive a whatsapp message from web.? I have good PHP programming skills.
It is not for commercial, not for marketing. Just a fun project for sending/receiving single messages
I will pay for it if not too expensive.
Kind Regards
kana
How can I find all the WhatsApp contacts / address book?
How can I send message to all contacts in WhatsApp address book?
Tal
sir please how can be bulk messages sent using php. I am in marketing business. i want to provide this service at affordable price. can you please guide
Hi everyone, maybe someone can help me.
I just only need to know if I have send a message from whatsapp, I mean, I need put a alert after send a message. Could I need the API or only with the implementation code in href (<a href="whatsapp://send?text=..) it is possible??
Thankss
I’m trying to make what’s app campaign software using this API in PHP. Can anyone guide me does this API really help me all on this project. My skype id :- nabinaomu . If anyone could guide me a bit too I would be really thankful.
Dear God, this just became a request forum for por skills Indian developers, who always ask for help!
I AM SAP ABAP DEVELOPER, IT IS POSSIBLE WHATSAPP INTEGRATION TO SAP ABAP PROGRAMME?
@David: You should see my e-mail inbox!
Hello Philipp
Are you being able to send WhatsApp messages now using the same method as we are no longer being able to.
Do you have any updated solution on this yet. Kindly advise.
Regards
Bikram
Tanks a lot for the tutorial, but the API was taken out of air, could you email it to me or upload it again an posta the link? I want to create a bot just for fun, tank you!
Is there any permanently solution for sending bulk Whatsapp messages
Hi Philipp
Its a innovative thing you had implemented congrats and thanks for that.
I have to implement it but I didn’t found the code on git please share me the working URL
git clone https://github.com/venomous0x/WhatsAPI here is only one img file and read me doc
Thanks again
Hi
sudo apt-get install git
this command is not working in my command prompt.
@chaturbhuj
it’s command in linux. Its not working on windows
how can i download whatsapp api. please provide a link
any other way to get this code?
My login getting expired every after few iterations. Why is like that?
Can You Sand WhatsApp API New Version Link
I am a php developer and I am new in whatsApp . I need your help I.e. when I am implement this whatsApi for sending a message in whatsApp but I have an issue. when i register my number with whatsapi then it log out in my device. and when i use in my device (same number) then i again verify my number in my device. and if i use in my php api script then i again register my number with api.
Please help me.
i tried to make php code that downloads whatsapp messages backup from drive, i used GOOGLE DRIVE API to act as the whatsapp android app itself, and download file from hidden appdata folder.
no i dont know how to save contents to a file.
CODE:
setAccessToken($accessToken);
$client->addScope(Google_Service_Drive::DRIVE_APPDATA);
$client->addScope(Google_Service_Drive::DRIVE_FILE);
$client->setClientId(“”); // client id and client secret can be left blank
$client->setClientSecret(“”); // because we’re faking an android client
$service = new Google_Service_Drive($client);
// Print the names and IDs for up to 10 files.
$optParams = array(
‘spaces’ => ‘appDataFolder’,
‘fields’ => ‘nextPageToken, files(id, name)’,
‘pageSize’ => 10
);
$results = $service->files->listFiles($optParams);
if (count($results->getFiles()) == 0)
{
print “No files found.\n”;
}
else
{
print “Files:\n”;
foreach ($results->getFiles() as $file)
{
print $file->getName() . ” (” . $file->getId() . “)\n”;
}
$content = $service->files->get(‘1BjeIaTO_eMxJ-XrLFhxGujpjUzXOYpi_EcVOjjOG03JW’, array(
‘alt’ => ‘media’ ));
}
function getGoogleDriveAccessToken($masterToken, $appIdentifier, $appSignature)
{
if ($masterToken === false) return false;
$url = ‘https://android.clients.google.com/auth’;
$deviceID = ‘0000000000000000’;
$requestedService = ‘oauth2:https://www.googleapis.com/auth/drive.appdata https://www.googleapis.com/auth/drive.file’;
$data = array(‘Token’ => $masterToken, ‘app’ => $appIdentifier, ‘client_sig’ => $appSignature, ‘device’ => $deviceID, ‘google_play_services_version’ => ‘8703000’, ‘service’ => $requestedService, ‘has_permission’ => ‘1’);
$options = array(
‘http’ => array(
‘header’ => “Content-type: application/x-www-form-urlencoded\r\nConnection: close”,
‘method’ => ‘POST’,
‘content’ => http_build_query($data),
‘ignore_errors’ => TRUE,
‘protocol_version’=>’1.1′,
//’proxy’ => ‘tcp://127.0.0.1:8080′, // optional proxy for debugging
//’request_fulluri’ => true
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if (strpos($http_response_header[0], ‘200 OK’) === false)
{
/* Handle error */
print ‘An error occured while requesting an access token: ‘ . $result . “\r\n”;
return false;
}
$startsAt = strpos($result, “Auth=”) + strlen(“Auth=”);
$endsAt = strpos($result, “\n”, $startsAt);
$accessToken = substr($result, $startsAt, $endsAt – $startsAt);
return “{\”access_token\”:\”” . $accessToken . “\”, \”refresh_token\”:\”TOKEN\”, \”token_type\”:\”Bearer\”, \”expires_in\”:360000, \”id_token\”:\”TOKEN\”, \”created\”:” . time() . “}”;
}
function getMasterTokenForAccount($email, $password)
{
$url = ‘https://android.clients.google.com/auth’;
$deviceID = ‘0000000000000000’;
$data = array(‘Email’ => $email, ‘Passwd’ => $password, ‘app’ => ‘com.google.android.gms’, ‘client_sig’ => ‘38918a453d07199354f8b19af05ec6562ced5788’, ‘parentAndroidId’ => $deviceID);
$options = array(
‘http’ => array(
‘header’ => “Content-type: application/x-www-form-urlencoded\r\nConnection: close”,
‘method’ => ‘POST’,
‘content’ => http_build_query($data),
‘ignore_errors’ => TRUE,
‘protocol_version’=>’1.1′,
//’proxy’ => ‘tcp://127.0.0.1:8080′, // optional proxy for debugging
//’request_fulluri’ => true
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if (strpos($http_response_header[0], ‘200 OK’) === false)
{
/* Handle error */
print ‘An error occured while trying to log in: ‘ . $result . “\r\n”;
return false;
}
$startsAt = strpos($result, “Token=”) + strlen(“Token=”);
$endsAt = strpos($result, “\n”, $startsAt);
$token = substr($result, $startsAt, $endsAt – $startsAt);
return $token;
}
my goal is to download whatsapp msgstore.crypt9 and media files with google credentials without the phone
Hi,
My PHP script in Amazon EC2 clould don’t send messages with WhatsApp API.
Why is that ?
Hi i get an error Error:
“There was an error with the AJAXss request. HTTP Error (500 Internal Server Error) .Internal Server Error ” .When i try to send message.
Please help me . anyone knows how to fix it please mail me syamps.fp@gmail.com
Can you use this API to send a message to a group of people or a channel?
Can i send message to multiple person and can listen response of every one?
Please remove this post if it’s no longer of use. There’s no point in attracting visitors to read your useless comment saying “you don’t know”
I want to send messages from my php website to whatsApp messenger
how i can do that what the code for that and where i write it??
Hello,
Thanks for your post, but i need bit inputs from your side.
I am using Android device for whatsapp.
Can you please guide to with each steps for how can i get “PhoneIdentity” and “Password” for that?
Thanks and Awaiting for your inputs.
Hi,
Philipp C. Heckel iam unable to get my whatsapp password with the link which you have provided,please help me to get my whatsapp password.
How can i download what’s app api please?
Hi,
So what is the different with the sending via WhatsApp it self ?
Regards
Hi.. could you please let me know how to send location through this library??