WhatsApp PHP Bot

Bot source code with basic functionality

On GitHub you can find an implementation of a simple WhatsApp chatbot that demonstrates the basic functionality of sending and receiving messages of different types and working with groups.

Using this source code will allow you to customize the bot to your needs or take it as a basis for creating any other integration.

Here's what this bot does:

  • Respond to an unfamiliar command, this could be an instruction or your welcome message;

  • Send regular message;

  • Send image;

  • Send file;

  • Send video;

  • Send contact (vCard);

  • Send product;

  • Create new group, send an invitation and send message to the group;

  • Receive and reading incoming messages;

  • Webhook Setup;

Getting Started

Step 1: Install Composer

Composer is a dependency manager for PHP. To install it:

  1. Visit the official Composer website https://getcomposer.org.

  2. Download and run Composer-Setup.exe for Windows or follow the installation instructions for MacOS or Linux.

Step 2: Install Dependencies

After installing Composer, install the necessary dependencies for your bot:

  1. Open the command line or terminal.

  2. Navigate to your project directory where the composer.json file is located.

  3. Run the command: composer install This reads the composer.json file, downloads the required libraries, and creates an autoload.php file that auto-loads all libraries in your project.

Step 3: Configure the Project

Configure your project settings:

  1. Open the config.php file in your IDE.

  2. Set up configurations such as your API token and webhook URL

Step 4: Launch the Bot

Now that dependencies are installed and the project is configured, you can launch the bot on your server or local machine. Ensure your server supports PHP and is accessible from the internet if you plan to use webhooks.


Multi-device Supported API: It's NOT necessary for the phone to be turned on or online for the bot to work. You can use the app as before.

If you need help, just message us in the support chat on any page of the site. We can help you with bot installation or customization.

Last updated