mgp25 edited this page Oct 6, 2015 · 7 revisions

Nodes

Note: tx means transmitted and rx received.

Remember to set $debug to TRUE in order to see the nodes.

Navigation:

Login nodes

Stream features

tx  <stream:features>
tx    <readreceipts></readreceipts>
tx    <groups_v2></groups_v2>
tx    <privacy></privacy>
tx    <presence></presence>
tx  </stream:features>

Sending authentication

tx  <auth mechanism="WAUTH-2" user="34123456789">?34123456789????Q???č?\?v?l$1444056358</auth>

Receiving challenge

rx  <start from="s.whatsapp.net"></start>

rx  <stream:features></stream:features>

rx  <challenge>?!?S??x?~?????fCR"?</challenge>

Our response

tx  <response>yD??5͔݃??pS	??k>jxy??4b?s??q?</response>

If everything went right, you will receive a success node. Next challenge it's in success node data

rx  <success t="1444056358" props="4" kind="free" status="active" creation="1440960194" expiration="1472496194">?0?$???
                                       R[?l??eC??.</success>

Sending our presence, this is our nickname in push notifications.

tx  <presence name="Chat API rocks!"></presence>

Pending messages and notifications. Before this node, you will have pending messages or notifications, in my case 67.

rx  <ib from="s.whatsapp.net">
rx    <offline count="67"></offline>
rx  </ib>

Our presence.

rx  <presence from="34123456789@s.whatsapp.net"></presence>

Server properties

Request

tx  <iq id="1" type="get" xmlns="w" to="s.whatsapp.net">
tx    <props></props>
tx  </iq>

Response (this changes denpending the platform, by default we use Nokia)

rx  <iq from="s.whatsapp.net" type="result" id="1">
rx    <props version="4">
rx      <prop name="timeout" value="300"></prop>
rx      <prop name="force_long_connect" value="0"></prop>
rx      <prop name="upload_oom_hprof_enabled" value="1"></prop>
rx      <prop name="wbarchive" value="1"></prop>
rx      <prop name="e2e_images" value="1"></prop>
rx      <prop name="e2e_groups" value="1"></prop>
rx      <prop name="e2e_blists" value="0"></prop>
rx      <prop name="mspes" value="1"></prop>
rx      <prop name="plaintext_reenable_threshold" value="5"></prop>
rx      <prop name="plaintext_disabled" value="1"></prop>
rx      <prop name="source" value="1"></prop>
rx      <prop name="location" value="0"></prop>
rx      <prop name="readreceipts" value="1415214000"></prop>
rx      <prop name="qr" value="1"></prop>
rx      <prop name="groups_v2" value="1"></prop>
rx      <prop name="lists" value="1"></prop>
rx      <prop name="library" value="0"></prop>
rx      <prop name="allow" value="all"></prop>
rx      <prop name="call" value="1"></prop>
rx      <prop name="audio" value="1"></prop>
rx      <prop name="checkmarks" value="0"></prop>
rx      <prop name="newmedia" value="0"></prop>
rx      <prop name="video_max_edge" value="960"></prop>
rx      <prop name="image_max_kbytes" value="5120"></prop>
rx      <prop name="image_quality" value="80"></prop>
rx      <prop name="image_max_edge" value="1600"></prop>
rx      <prop name="media" value="16"></prop>
rx      <prop name="broadcast" value="50"></prop>
rx      <prop name="max_subject" value="25"></prop>
rx      <prop name="max_participants" value="101"></prop>
rx      <prop name="max_groups" value="9999"></prop>
rx    </props>
rx  </iq>

Get privacy blocked list

Request

tx  <iq id="1" xmlns="jabber:iq:privacy" type="get">
tx    <query>
tx      <list name="default"></list>
tx    </query>
tx  </iq>

If you don't have any blocked contacts you will receive this:

rx  <iq from="34123456789@s.whatsapp.net" type="error" id="1">
rx    <error code="404" text="item-not-found"></error>
rx  </iq>

Otherwise, you will receive a list with the contacts you have blocked:

rx  <iq from="34123456789@s.whatsapp.net" type="result" id="1">
rx    <query>
rx      <list name="default">
rx        <item type="jid" action="deny" order="1" value="34987654321@s.whatsapp.net"></item>
rx      </list>
rx    </query>
rx  </iq>

Syncing contacts

Request

tx  <iq id="1" xmlns="urn:xmpp:whatsapp:sync" type="get">
tx    <sync mode="delta" context="background" sid="130886066860000000" index="0" last="true">
tx      <user>+34987654321</user>
tx    </sync>
tx  </iq>

If the contact has a WhatsApp account, it will be between the <in> tags, if not, between the <out> tags

rx  <iq from="34123456789@s.whatsapp.net" type="result" id="1">
rx    <sync index="0" sid="130886067400000000" last="true" version="1444129540423375">
rx      <in>
rx        <user jid="34987654321@s.whatsapp.net">+34987654321</user>
rx      </in>
rx      <out>
rx        <user jid="34121212121@s.whatsapp.net">+34121212121</user>
rx      </out>
rx    </sync>
rx  </iq>

Presence subscription

Request

tx  <presence type="subscribe" to="34987654321@s.whatsapp.net"></presence>

If the contact is not online (where last is the last seen online)

rx  <presence from="34987654321@s.whatsapp.net" type="unavailable" last="1444130008"></presence>

If the user is online

<presence from="34987654321@s.whatsapp.net"></presence>

Sending and receiving chat state

Writing

tx  <chatstate to="34987654321@s.whatsapp.net">
tx    <composing></composing>
tx  </chatstate>

Paused

tx  <chatstate to="34987654321@s.whatsapp.net">
tx    <paused></paused>
tx  </chatstate>

Sending text messages

Sending message (not encrypted)

tx  <message to="34987654321@s.whatsapp.net" type="text" id="7liN5/6d+im50" t="1443704300">
tx    <body>No one likes Facebook!</body>
tx  </message>

Sending message (encrypted)

tx  <message to="34987654321@s.whatsapp.net" type="text" id="Sq2OuZNjKaOG0" t="1444130442" notify="Chat API">
tx    <enc v="1" type="pkmsg">3(????0!xh̊?
??ͷ??????5mF?@? vEiw"@3\?p
!
Q?f*;?.̧PuE
          q<z<_,ڒM0??O?T?k_"
                            ?R?jm???t?<;w???d?he#</enc>
tx  </message>

Ack and receipt (received client and read receipt)

rx  <ack from="34987654321@s.whatsapp.net" class="message" id="Sq2OuZNjKaOG0" t="1444130442"></ack>

rx  <receipt from="34987654321@s.whatsapp.net" id="Sq2OuZNjKaOG0" t="1444130445"></receipt>

tx  <ack to="34987654321@s.whatsapp.net" class="receipt" id="Sq2OuZNjKaOG0" t="1444130445"></ack>

rx  <receipt from="34987654321@s.whatsapp.net" type="read" id="Sq2OuZNjKaOG0" t="1444130445"></receipt>

tx  <ack to="34987654321@s.whatsapp.net" class="receipt" id="Sq2OuZNjKaOG0" t="1444130445" type="read"></ack>

Notification nodes

Type = contacts

rx  <notification from="xxx" id="12312" type="contacts" t="123">
rx     <remove jid="yyy"></remove>
rx  </notification>
rx  <notification from="xxx" id="12312" type="contacts" t="123">
rx     <add jid="yyy"></add>
rx  </notification>
rx  <notification from="xxx" id="12312" type="contacts" t="123">
rx     <update jid="yyy"></update>
rx  </notification>
  • add requires you to mark a contact you synced previously as an actual WhatsApp user
  • remove means that a user is not on WhatsApp anymore, so it becomes just a regular contact
  • update means that something has changed on the user profile. You should:
  • reset the presence subscription (unsubscribe and subscribe again)
  • request the user status
  • request the user profile image

type = w:gp2

rx  <notification from="xxxx" id="xxx" participant="xxx" type="w:gp2" t="xxx" notify="xxx">
rx      <remove subject="xxx">
rx           <participant jid="xxx"></participant>
rx      </remove>
rx </notification>

rx  <notification from="xxxx" id="xxx" participant="xxx" type="w:gp2" t="xxx" notify="xxx">
rx      <add subject="xxx">
rx           <participant jid="xxx"></participant>
rx      </add>
rx </notification>
  • add An user was added to a group
  • remove An user was removes from a group

There are also notification if the group has updates the subject or picture, if the user has been promoted or demoted.

Type = web

rx  <notification from="553499833260@s.whatsapp.net" id="508859621" retry="1" offline="1" type="web" t="1430773333">
rx    <action type="sync">
rx      <sync type="required">@3dpGL6skDNNiUDEzcl3hiQnFhD+11D2odOuwFiHxpB73EHLhCkau2eEl</sync>
rx      <code>EvwDSmI/8wW6Ragp+8rEq6da2zkb9Y2Bg2MGQlrLQoY=</code>
rx      <name>5mwUAgIZF6HLNIR9w+XruQ==</name>
rx    </action>
rx  </notification>
  • sync webSync

Type = account

rx  <notification from="s.whatsapp.net" id="1636332225" offline="0" type="account" t="1412690302" notify="Server">
rx    <redeem sku="1" delta="365" author="49150000000@s.whatsapp.net">
rx      <account kind="paid" status="active" creation="1409323492" expiration="1503931492"></account>
rx    </redeem>
rx  </notification>
  • Payment notification, when you have bought WhatsApp subscription one more year.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.