linux:whatsapp
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| linux:whatsapp [2014/12/27 15:12] – created rlunaro | linux:whatsapp [2016/09/17 15:21] (current) – removed rlunaro | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Send Whatsapps from linux (just another recipe) ====== | ||
| - | |||
| - | I've found two libraries to sends whatsapps from Linux (and Windows, too): | ||
| - | |||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | |||
| - | |||
| - | I've found that the yowsup library works very well in the process of registering a telephone number and getting the necessary password. The problem of this library now is that it's too complicated to send a single message (I've tried it hard, I promise). | ||
| - | |||
| - | On the other hand WhatsAPI is simple to use, but --as far as I know--, the registration does not work. | ||
| - | |||
| - | So, I decided to mix the best of two worlds and get a process more or less simple to send a simple message. | ||
| - | |||
| - | ===== Register your phone number with yowsup ===== | ||
| - | |||
| - | Download the code: | ||
| - | |||
| - | < | ||
| - | git clone https:// | ||
| - | </ | ||
| - | |||
| - | Start the registration by invoking: | ||
| - | |||
| - | < | ||
| - | yowsup-cli registration --requestcode sms --phone 49XXXXXXXX | ||
| - | </ | ||
| - | |||
| - | Then, an sms will be sent to the phone in question. After this, confirm the registration by invoking: | ||
| - | |||
| - | < | ||
| - | yowsup-cli registration --register 123456 --phone 49XXXXXXXX | ||
| - | </ | ||
| - | |||
| - | After this, you will get a phone number and a password. With this, you can use WhatsAPI to send your messages. | ||
| - | |||
| - | ==== Send a message with WhatsAPI ==== | ||
| - | |||
| - | Download the source code of WhatsAPI: | ||
| - | |||
| - | < | ||
| - | git clone https:// | ||
| - | </ | ||
| - | |||
| - | I've created a simple php program that just sends a message and exits: | ||
| - | |||
| - | <code php> | ||
| - | <?php | ||
| - | set_time_limit(10); | ||
| - | require_once ' | ||
| - | //Change to your time zone | ||
| - | date_default_timezone_set(' | ||
| - | |||
| - | /////////////////////// | ||
| - | ////////////////////////////////////////////////////////// | ||
| - | $username = " | ||
| - | $password = "PUT THE PASSWORD HERE"; // A server generated Password | ||
| - | $identity = ""; | ||
| - | $nickname = ""; | ||
| - | $target = $argv[1]; // Destination telephone number including the country code | ||
| - | $debug = false; // Set this to true, to see debug mode. | ||
| - | /////////////////////////////////////////////////////////// | ||
| - | |||
| - | $w = new WhatsProt($username, | ||
| - | $w-> | ||
| - | |||
| - | // Now loginWithPassword function sends Nickname and (Available) Presence | ||
| - | $w-> | ||
| - | |||
| - | $w-> | ||
| - | |||
| - | ?> | ||
| - | |||
| - | </ | ||
| - | |||
| - | And you can call by the command line: | ||
| - | |||
| - | < | ||
| - | $ php5 49DESTINATIONPHONE "this is a test message" | ||
| - | </ | ||
| - | |||
| - | and that's it: sending whatsapp from a computer, direct and simple. | ||
| - | |||
| - | |||
| - | |||
| - | |||
linux/whatsapp.1419693124.txt.gz · Last modified: 2022/12/02 21:02 (external edit)
