Developer to developer

Playing yowsup2 and whatsapi

This yowsup2 installation requirement is valid. But I found I had to apt-get install python2.7-dev too, before I can pip install Pillow. Next you can register your number using yowsup-cli. Now test send messages using this command yowsup-cli demos -c -y. Type /help for all command and /L to quick login. Type /message send <number-to> <your-message-here>.

WhatsAPI is more easy to install but I wanna share simple .php test. First git clone the source from github to your /var/www/, and after downloaded, place this php file on /var/www/WhatsApi-Official/.

<?php
require 'src/whatsprot.class.php';
require 'src/events/MyEvents.php';
$username = "your-phone-number ex.62811987654";
$identity = "your-phone-number";
$nickname = "your-phone-number";
$password = "your-password"; // The one we got registering the number
$debug = true;

// Create a instance of WhastPort.
$w = new WhatsProt($username, $identity, $nickname, $debug);
connect(); // Connect to WhatsApp network
$w->loginWithPassword($password); // logging in with the password we got!

//Send Messages
$target = ‘to-phone-number’; // The number of the person you are sending the message ex.6285798766543
$message = ‘Hi!🙂 this is a test message’;
$w->sendMessage($target , $message);

//Receive Messages
$events = new MyEvents($w);
$events->setEventsToListenFor($events->activeEvents);
$w->pollMessage();
?>

Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s