This project is abandoned and won't be maintained anymore, sorry.
Baca dalam Bahasa Indonesia.
A very simple WhatsApp bot script built using Chat-API library. This bot will send back any private message sent to it, and it also respond to "!ping" or "!help" sent to group.
Of course you can always add new feature or new function to this bot, this script is super simple, enough to give you a clue on how Chat-API works.
This project is set up and tested on Ubuntu Linux system. If you're on other system or you can't find more detail on any particular information on this repo, you should always refer to Chat-API.
Install dependencies using command:
sudo apt-get update
sudo apt-get install ffmpeg openssl php5-cli php5-gd php5-curl php5-sqlite php5-mcrypt
IMPORTANT! WhatsApp now using encryption on its message, you need to install additional PHP extensions so the script can read encrypted messages. Please follow this guide on how to install them! MUST!
Make sure that all dependencies succesfully installed. Some things you need to check is:
php -v
PHP 5.6.16-2+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2015 The PHP Group
......
php -m
..
curve25519
mcrypt
protobuf
..
If everything is OK, you can proceed to the next step.
There ada some tools we can use to get WhatsApp password:
Here we will use registerTool.php (you can always use other tool, their function is same, please refer to Chat-API).
cd whatsapp/examples/
php registerTool.php
6285xxxxxxxxx
XXX-XXX
formatgojigejeB79ONvyUV87TtBIP8v7=
If registration was unsuccessful, please examine the command's output then refer to Chat-API Issues to find for the cause and how to deal with it.
If you've got the password, then the next step is to run the wasapbot.php script.
$username
, $password
, and $nickname
according to your bot details.php wasapbot.php
error_reporting(....)
(row 19, wasapbot.php) so PHP will display script error, check if there's an error.$debug
variable into true so Chat-API will run in debug mode, check the debug output.In this project, we only use 2 event as an example, onGetMessage(...)
to get private message, and onGetGroupMessage(...)
to get group message. You can change bot's response by editing the script inside those function. (row 126 and 182, wasapbot.php).
You can also add other event to add bot's capability, please refer to Chat-API Events for the list of available events.