문제

I'm trying to use the WhatsAPI library to send a message to a smartphone by a computer. I obtained the credential by using mitmproxy on a Linux Ubuntu computer, then I installed the certificate for an iPhone and I connected the iPhone on the same wi-fi network in which I've connected the Linux computer (I set up the network for use my proxy).

So I edited the file whatsapp.php (contained in Github package) with the credential I obtained in previous step and I started the service in a Shell to send a message to my phone in this way:

./whatsapp.php -s dest phone prova

when I press "enter" it began to work and I obtain the following:

[] Logging in as 'WhatsAPI Test' (from phone)
tx  <stream:features></stream:features>

tx  <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="WAUTH-2" user="from phone">??lg
               @*?*]?Z??ù?%??\?Z??Ǚ??R0??q??*???kX?L?Y%3????p>R-A_j'??ǯYN?1ƿ#t?$s?????ORLUG?dBvoI?</auth>

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

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

rx  <challenge>??2?a?
                     ?dxւ??㶄?</challenge>

tx  <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">u^?
)???4!???N?$+?H5??????Da?P</response>

rx  <success t="1396431143" kind="free" status="active" creation="1396347026" expiration="1427883026">???'17?,E??.??}??</success>

rx  <message from="dest phone@s.whatsapp.net" id="1396425196-49" retry="3" offline="3" type="text" t="1396431017" notify="Luca">
rx    <body>Prova</body>
rx  </message>

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

tx  <presence name="WhatsAPI Test"></presence>


[] Request last seen dest phone: tx  <iq to="dest phone@s.whatsapp.net" type="get" id="lastseen-1396431145-1" xmlns="jabber:iq:last">
tx    <query></query>
tx  </iq>

rx  <stream:error>
rx    <xml-not-well-formed></xml-not-well-formed>
rx  </stream:error>


[] Send message to dest phone: prova 
tx  <message to="dest phone@s.whatsapp.net" type="text" id="message-1396431150-2" t="1396431150">
tx    <x xmlns="jabber:x:event">
tx      <server></server>
tx    </x>
tx    <notify xmlns="urn:xmpp:whatsapp" name="WhatsAPI Test"></notify>
tx    <request xmlns="urn:xmpp:receipts"></request>
tx    <body>prova </body>
tx  </message>

I'm not understanding if the server has elaborated well my request or not, for now I din't receive any WhatsApp message on my smartphone. There's something wrong?

도움이 되었습니까?

해결책

I know this is quite old, however, would like to answer it.

Could make out in the below lines:

<message from="dest phone@s.whatsapp.net" id="1396425196-49" retry="3" offline="3" type="text" t="1396431017" notify="Luca">
rx    <body>Prova</body>
rx  </message>

you haven't changed the destination phone number which is why it shows

message from="dest phone@s.whatsapp.net"

and also

Request last seen dest phone: tx iq to="dest phone@s.whatsapp.net"

Just input your destination phone number and your code should be working fine.

P.S. WhatsApi do not support spam, hence, if you do so, your number would be blocked.

Hope this helps.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top