FORUMS

[GUIDE] Send Whatsapp messages using Tasker

360 posts
Thanks Meter: 79
 
By hotsync100, Senior Member on 1st December 2013, 02:38 PM
Post Reply Email Thread
For a long time, I was looking the way to send automated Whatsapp messages using Tasker. Some days ago, I read a blog with the steps to run a Python Script (on Linux), and gave me the idea to test it on my HTC One using SL4A

I tried to use with SL4A, but it didn't work.. I had to modified the script (by trial and error.. Sorry I do not know Phyton).. And it WORKED!!!

All the credits goes to Tarek who created the yowsup-cli script: https://github.com/tgalal/yowsup/wiki/yowsup-cli

As you see, I'm not "an expert", but I wanted to share what I did with you .. Probably you could improve it a lot..

Prerequisites:
(I'm not going to explain how to install it):
SL4A ==> https://code.google.com/p/android-scripting/)
Phyton for Android ==> https://code.google.com/p/python-for...downloads/list (I use PythonForAndroid_r5.apk)
Tasker
Yowsup-cli ==> https://github.com/tgalal/yowsup/wiki/yowsup-cli
python-dateutil ==> http://labix.org/python-dateutil
Modified Scripts ==> wa_scripts.rar
A phone number not registered on Whatsapp

STEPS:
1. Download Yowsup-cli, open the zip and copy the folders Yowsup and Examples on sl4a folder ( /sdcard/sl4a/scripts)
2. Download python-dateutil, open the tar and copy the folder dateutil on /sdcard/sl4a/scripts/Yowsup/Common
3. Download wa_scripts.rar, open and copy the _wa_code.py, _wa_reg.py, wa_send.py files on /sdcard/sl4a/scripts/
4. Open _wa_code.py modify these lines with your country code and phone number and save

countryCode = "58"
login = "584147777777"

You will ask a registration code on next step. It supposed to be sent by SMS. This could be a little bit frustrating because sometimes the SMS does not arrives. There are a lot of Issues reported of it (https://github.com/tgalal/yowsup/issues/147)
In my case, I tried with six different phone numbers until the first SMS arrived.

If you get this error : status: fail / reason: old_version, you could use this link to register https://coderus.openrepos.net/whitesoft/whatsapp_sms

5. Open SL4A and run _wa_code.py script. It should send you a SMS code with this format (XXX-XXX). Copy the code without "-". You will use it on next step. It could take some time.
If you do not receive the SMS, could try with this https://coderus.openrepos.net/whitesoft/whatsapp_sms
Click image for larger version

Name:	2013-11-26 01.19.28.jpg
Views:	10048
Size:	141.5 KB
ID:	2426268

6. Register the code: open _wa_reg.py, modify these lines with your country code,phone number code , save and run.

countryCode = "58"
login = "584147777777"
code = "999999"

Click image for larger version

Name:	2013-11-26 01.21.47.jpg
Views:	8059
Size:	148.9 KB
ID:	2426269

7. If you successfully register, Whatsapp will generate a password for you, which will be displayed in the command output. Copy the pw (password) and paste on file

wa_send.py like this:

login = "584247777777"
phone = "584147777777"
message = "Test WhatsApp #1"
countryCode = "58"
method = "sms"
identity = ""
password = "MDAwMDAwMDAwMA=="

8. Now you could run wa_send.py script on SL4A to test if it works. It should be like this:

Click image for larger version

Name:	2013-11-26 01.27.54.jpg
Views:	7225
Size:	148.7 KB
ID:	2426270

9. create a task in Tasker like this:
Click image for larger version

Name:	2013-12-01 14.01.31.png
Views:	8786
Size:	200.5 KB
ID:	2426272 Click image for larger version

Name:	2013-12-01 14.01.39.jpg
Views:	9159
Size:	104.8 KB
ID:	2426275

Fill %phone and %text variables and you are ready to send the message.

I hope it works for you.. I use it to auto reply Whatsapps and all kind of schedule messages
The Following 4 Users Say Thank You to hotsync100 For This Useful Post: [ View ] Gift hotsync100 Ad-Free
3rd February 2014, 12:26 AM |#2  
KostasR's Avatar
Senior Member
Thanks Meter: 20
 
More
This seems great. I will give it a shot!

Sent from my Optimus G using Tapatalk 4 Pro
23rd February 2014, 01:18 PM |#3  
Member
Thanks Meter: 9
 
More
Yowsup got DMCA'ed.

Sent from my HTC Butterfly using Tapatalk
24th February 2014, 02:53 AM |#4  
JOKERz's Avatar
Senior Member
Flag Grave
Thanks Meter: 28
 
More
any mirror for yowsup?
24th February 2014, 03:45 PM |#5  
OP Senior Member
Flag Caracas
Thanks Meter: 79
 
Donate to Me
More
Quote:
Originally Posted by JOKERz

any mirror for yowsup?

Dropbox: https://www.dropbox.com/s/qevu77wt02...sup-master.zip
The Following 2 Users Say Thank You to hotsync100 For This Useful Post: [ View ] Gift hotsync100 Ad-Free
27th February 2014, 02:04 PM |#6  
OP Senior Member
Flag Caracas
Thanks Meter: 79
 
Donate to Me
More
I'm using a new method to send Whatsapp messages with tasker ..

You only need:
1) ROOT
2) Sqlite
3) Tasker

Tho send a Whatsapp message, you have to perform this Task with 2 parameters:

1) Phone . Formatted like this :
58[email protected] (single contact)
584165554433-1383418375[email protected] (group chat)

2) Text to send.

Note: Previosuly you need to fill the variable %Sqlite3 with the full path of sqlite ..
Example if you use Titanium Backup: /data/data/com.keramidas.TitaniumBackup/files/sqlite3

Click image for larger version

Name:	Screenshot_2014-02-27-08-49-55.jpg
Views:	3869
Size:	137.4 KB
ID:	2603748

Send Whatsapp (192)
A1: Variable Set [ Name:%phone To:%par1 Do Maths:eek:ff Append:eek:ff ]
A2: Variable Set [ Name:%data To:%par2 Do Maths:eek:ff Append:eek:ff ]
A3: Variable Add [ Name:%Cont Value:1 Wrap Around:8 ]
A4: Variable Search Replace [ Variable:%phone Search:* Ignore Case:eek:ff Multi-Line:eek:ff One Match Only:eek:ff Store Matches In: Replace Matches:eek:n Replace With: ]
A5: Variable Set [ Name:%key_id To:%TIMES-%Cont Do Maths:eek:ff Append:eek:ff ]
A6: Run Shell [ Command:%Sqlite3 /data/data/com.whatsapp/databases/msgstore.db "INSERT INTO messages (key_remote_jid, key_from_me, key_id,status, needs_push, data, timestamp, media_url, media_mime_type, media_wa_type, media_size, media_name, latitude, longitude, thumb_image, remote_resource, received_timestamp, send_timestamp, receipt_server_timestamp, receipt_device_timestamp, raw_data, media_hash, recipient_count, media_duration, origin) VALUES ('%phone',1,'%key_id',0,0,'%data',%TIMEMS,'','','0 ',0,'',0.0,0.0,' ','',%TIMEMS,-1,-1,-1,0,'',0,0,0);
update chat_list set message_table_id = (select max(messages._id) from messages) where chat_list.key_remote_jid = '%phone' ; " Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: Continue Task After Error:eek:n ]
A7: Kill App [ App:WhatsApp Use Root:eek:n Continue Task After Error:eek:n ]
The Following 5 Users Say Thank You to hotsync100 For This Useful Post: [ View ] Gift hotsync100 Ad-Free
27th February 2014, 04:46 PM |#7  
jeswinjv's Avatar
Senior Member
Thanks Meter: 15
 
More
Can u explain in easy language??.....i didn't get....

via Tapatalk
27th February 2014, 07:15 PM |#8  
UnitedOceanic's Avatar
Senior Member
Thanks Meter: 118
 
More
@hotsync100

i really like the new method, thank you!! have to try this!

@jeswinjv

if i understand it correctly it works like this:

whatsapp saves messages in to a database file, with these tasker tasks, we write directly into the database with a shell command and the sqlite binary (in this case the one that comes with titanium backup, many other apps have the same binary included). the tasker task kills whatsapp so it will restart and reload the database, it will find a new entry and send the new message.
The Following 4 Users Say Thank You to UnitedOceanic For This Useful Post: [ View ] Gift UnitedOceanic Ad-Free
27th February 2014, 09:52 PM |#9  
OP Senior Member
Flag Caracas
Thanks Meter: 79
 
Donate to Me
More
Quote:
Originally Posted by UnitedOceanic

@hotsync100

i really like the new method, thank you!! have to try this!

@jeswinjv

if i understand it correctly it works like this:

whatsapp saves messages in to a database file, with these tasker tasks, we write directly into the database with a shell command and the sqlite binary (in this case the one that comes with titanium backup, many other apps have the same binary included). the tasker task kills whatsapp so it will restart and reload the database, it will find a new entry and send the new message.

Exactly!

Sent from my Nexus 7 using Tapatalk
28th February 2014, 03:53 AM |#10  
Member
Thanks Meter: 9
 
More
Anyone considering Whatstasker.

https://play.google.com/store/apps/d...ev.whatstasker

Sent from depth of the earth
The Following 2 Users Say Thank You to kemikelx For This Useful Post: [ View ] Gift kemikelx Ad-Free
28th February 2014, 06:11 AM |#11  
jeswinjv's Avatar
Senior Member
Thanks Meter: 15
 
More
Quote:
Originally Posted by UnitedOceanic

@hotsync100

i really like the new method, thank you!! have to try this!

@jeswinjv

if i understand it correctly it works like this:

whatsapp saves messages in to a database file, with these tasker tasks, we write directly into the database with a shell command and the sqlite binary (in this case the one that comes with titanium backup, many other apps have the same binary included). the tasker task kills whatsapp so it will restart and reload the database, it will find a new entry and send the new message.

ThanQ....reaLy nw geTit...:thumbup:





Quote:
Originally Posted by hotsync100

Exactly!

Sent from my Nexus 7 using Tapatalk



via Tapatalk
Post Reply Subscribe to Thread

Tags
python, sqlite, tasker, whatsapp, yowsup

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes