My name is Philipp C. Heckel and I write about nerdy things.

Send WhatsApp messages via PHP using WhatsAPI

Mobile, Programming, Scripting

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.



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

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, 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:

To download my two minimal examples, run the following commands, and edit the file whatsapp_whatsapi_config.php to set your own user credentials:

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:

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:

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:

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:

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:

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.


  1. Matsoso Seboka

    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 Or rather, if you don’t have or can’t suggest me any code, is it possible to run php scripts silently on a server? Thank you.


    Matsoso Seboka

  2. Philipp C. Heckel

    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

    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 and call it from the program like this:

    Hope this helps,

  3. ankit verma

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

  4. Philipp C. Heckel

    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:

  5. deepak goud

    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 .

    Deepak goud

  6. Irving Esquivel

    Hi Philipp, Where do you get the variable $userIdentity ?

  7. Philipp C. Heckel

    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.

  8. Said Ghzayel

    Hellp Phillip
    Please i want any Tutorial video or a php website to test it ?

  9. Kumar

    Hi Phillip,
    Can you send the demo for this api??? Its not working

  10. Philipp C. Heckel

    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:

    From what I can see (without testing), here are the new names:

  11. Ketan

    Not able to get the password after Restore messages. I think whats app done some encryption method. Please help me …..

  12. Francis

    We want to incorporate this in an app but was wondering about the legalities. Any thoughts on that?

  13. Philipp C. Heckel

    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.

  14. Kirill

    What is the $userIdentity? Or how I can get it from my phone?

    Many thanks in advance!

  15. Kirill

    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:

    $userPhone = ‘490176xxxxxxx’;
    $userIdentity = ‘XX:XX:XX:XX:XX:XX’;
    $userName = ‘Test’;
    $password = ‘di2349dsjkdfj239230sdk39203dj3923e’;

  16. Kirill

    Just saw: .

  17. erwin

    hi can i use this to incept / send whatsapp messages from a blackberry phone
    if i have the IMEI no and password?

  18. Pang Yoke Chin

    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]

  19. ss

    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?

  20. juanjosezg

    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 :(

  21. Philipp C. Heckel

    That’s unfortunately true. I have mentioned that in the first part of this tutorial:

  22. George

    Hi Philipp,

    is there any possibility to create a password for a BlackBerry Q10?
    Didn’t find anythin, hope you can help me.


  23. pniaz

    Thanks for your posts.
    The method Message doesn’t exist now. You need replace to sendMessage.

  24. BRuno

    is possible send a push notify whatsapp by Email ?
    i want to send an email to see a push whatsapp notify, is possible ?

  25. emmi

    Hi, is there any posibility to find out the password after WhatsApp did the changes? Is the script still useful?

  26. emmi

    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

  27. Sachin


    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.

  28. Johnny Zambrano

    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?

  29. JeReC

    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] =>
    [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.

  30. Philipp C. Heckel

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

  31. Tim

    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.

  32. Dhiraj Rokade

    Can you please describe how to configure status text for whatsapp with api.

  33. windbell

    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?

  34. nitish

    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 ?

  35. Shardul thakkar

    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

  36. Yooto

    Hi Philip
    Is there a way to know the nick name of a user using their phone number?

  37. tooooot

    hi .i had install your whats app script but the receiver not receive the message ?

    2 – whats is the id in whatsapp.php file ?

  38. rick

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

  39. rohman

    hello mr….
    how can i get outgoing messages????
    help me please!!!!

  40. Dipak Chavda

    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.

  41. Ammar

    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

  42. Speedmoon

    Hello sir

    I am not able to download file from specified URl could you please tell me how can i download it

  43. MoustafaGhoniem

    After the removal of WhatsAPP due to DMCA is there anyway that i can interact with WhatsAPP ?

  44. roclet

    Hi philip thank you
    But i trtrying to run the listen it says ,i can’t found this class RawPacket.

  45. Dusk Payne

    I am not able to find the WhatsApp API setup compatible with my device.Please help me get it.Any help would be appreciated.

  46. Akil Belim

    When I click for API it shows this “Repository unavailable due to DMCA takedown”

  47. Anupam baruah

    dear friends…
    this is the code

    $w->Message($destinationPhone, $argv[1]);


    but i couldnot find “whatsapp_whatsapi_config.php” file in whatdsapp github file

  48. Ranjita

    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.

  49. Ranjita

    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.

  50. Vinoth


    Can you advise me how to send the html message through the API.


  51. vinoth


    Your tutorial will helped me a lot. i have a query, how to send the a href link messages.


  52. monu

    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.

  53. J.C. Denton

    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 »./«:

    #!/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]
    ./whatsapp_whatsapi_send.php “SPAMTEXT”
    # Consider altering $destinationPhone in
    # »whatsapp_whatsapi_send.php« by using $argv[2].
    # 0 = whatsapp_whatsapi_send.php
    # 1 = SPAMTEXT,
    # Of course one can add more parameters if needed.

    sleep 1s
    # You may want to circumvent WA spam detection by using
    # higher values.

    I know he script above is so lame, but does the job I assume. By the way the WhatsApp API is available elsewhere.

    C# w/ Windows:

    Have fun! :]

  54. J.C. Denton

    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.

  55. sem

    I was wondering, since they don’t use the IMEI anymore, what should my identity be then?

  56. Shifali

    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

  57. yariv halfon


    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?

  58. noam sheffi

    Dear Guys

    I would like to send HTTP link such as 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)

  59. Valéria Silva

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

  60. lennon

    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

  61. Hiury Oliveira

    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

  62. Tales

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

  63. DHAYNI

    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?

  64. eric

    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


  65. Felix

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


  66. rajiv

    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…

  67. Parth

    Hi, Can you send me the script code ready made download which works perfect?
    I want to use it.

  68. Parth

    Can you send me the Github link to download this scripts or send me on my mail address please?

  69. karan

    how to store recived messages and numbers in variable to store messages in our database

  70. Anthony

    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,


  71. Abdelmawla

    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.


  72. Chemi

    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?

  73. Fabiano

    Hello, i want to create a app in vb, can i use whatsapp in this project? Or another way, htt for example, thanks.

  74. Abhishek Jha

    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

  75. Cesar

    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.

  76. Hajrieyan

    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.


  77. Saurabh nagar

    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

    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

  78. YASH

    I want this software of bulk whatsapp
    please if any 1 cn provid me then
    mail me

  79. Deb

    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.

  80. dany

    whatsapp blocked my number after sending 20+ messages,is there any way to use this api effectively?any suggestions?

  81. Gokhan G.

    Hi Philipp,
    There is an extension for Opencart web sites lets you to share products with your friends by whats app.
    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.
    Best Regard.
    Gokhan Gokce

  82. Daryl.

    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?

  83. Akash Jain

    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,

  84. Afiffuddin

    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?

  85. bhavik

    Hello phillip
    is there any api that we can use for image + caption text share using iphone
    I can share either of that

  86. Tom

    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…

  87. saurabh

    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.

  88. Ravi

    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!

  89. ansh

    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

  90. ansh

    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

  91. yogesh kumar

    Hi ,

    First please tell me which file is run. I have run whatsapp.php but all cretintial error show. Please give me suggestion.

  92. jawad

    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

  93. Gigih

    Thanks, Phillips.
    Will you suggest on how to send simple text to whatsapp group?

  94. Ashok

    $userPhone = ‘490176xxxxxxx’;
    $userIdentity = ‘XX:XX:XX:XX:XX:XX’;
    $userName = ‘Test’;
    $password = ‘di2349dsjkdfj239230sdk39203dj3923e’;

    please give me details above this

  95. yash

    can u possible to send sms without whatsapp password? if yes so how?

  96. Raul

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

  97. Thivya

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

  98. Javier Salvay

    Hi guys, is there any other up to date article talking about this?

  99. mauroslucios

    Error: There was an error with the AJAX request. HTTP Error (500 Internal Server Error) .Internal Server Error

  100. Vivek Moyal

    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

  101. Hi

    The github page you posted isn’t working please share the code and send again

  102. Boomani

    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

  103. nbn

    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 )

  104. Sundargopal Sarkar

    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?

  105. Kana

    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

  106. Tal

    How can I find all the WhatsApp contacts / address book?
    How can I send message to all contacts in WhatsApp address book?

  107. Yuvraj pawar

    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

  108. jmara

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


  109. Nabina

    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.

  110. David

    Dear God, this just became a request forum for por skills Indian developers, who always ask for help!

  111. JAY


  112. Bikram Vaskar

    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.


  113. Tarcísio Francisco Batista Filho

    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!

  114. Rajeshrathi

    Is there any permanently solution for sending bulk Whatsapp messages

  115. Ganesh Yewale

    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 here is only one img file and read me doc

    Thanks again

  116. cuwid

    it’s command in linux. Its not working on windows

  117. Adnan

    My login getting expired every after few iterations. Why is like that?

  118. Rituraj

    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.

  119. Md Ashikur Rahman

    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.

    $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”;
    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 = ‘’;
    $deviceID = ‘0000000000000000’;
    $requestedService = ‘oauth2:’;
    $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,
    //’proxy’ => ‘tcp://′, // 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 = ‘’;
    $deviceID = ‘0000000000000000’;
    $data = array(‘Email’ => $email, ‘Passwd’ => $password, ‘app’ => ‘’, ‘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,
    //’proxy’ => ‘tcp://′, // 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

  120. Paulo Pereira


    My PHP script in Amazon EC2 clould don’t send messages with WhatsApp API.
    Why is that ?

  121. syam

    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

  122. Ashish Patel

    Can i send message to multiple person and can listen response of every one?

  123. Bhawna

    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”

  124. fatma aljabri

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

  125. Vishal Uamraneeya

    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.

  126. charily

    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.

  127. edo

    So what is the different with the sending via WhatsApp it self ?


  128. Vijay

    Hi.. could you please let me know how to send location through this library??