PHPackages                             chandachewe/whatsapp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. chandachewe/whatsapp

ActiveProject

chandachewe/whatsapp
====================

A PHP Package for Business Whatsapp API

v1.0.1(4mo ago)116↓100%1MITPHPPHP ^8.1

Since Mar 19Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/chandachewe10/whatsapp-api)[ Packagist](https://packagist.org/packages/chandachewe/whatsapp)[ RSS](/packages/chandachewe-whatsapp/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (4)Used By (0)

WhatsApp Business API
=====================

[](#whatsapp-business-api)

This package shows you how to make WhatsApp Business API requests from your PHP Project.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1

Installation
------------

[](#installation)

Install this package using `composer require`:

```
composer require chandachewe/whatsapp
```

Usage
-----

[](#usage)

### Template Message

[](#template-message)

You need to create a template message from the whatsapp business API [Developer Portal](https://developers.facebook.com/)

```
require 'vendor/autoload.php';
use Chandachewe\Whatsapp\Messages\TemplateMessage;

$templateMessage = new TemplateMessage(
'v19.0',
'BUSINESS PHONE NUMBER ID',
'RECIPIENT PHONE NUMBER',
'TOKEN'
);

$response = $templateMessage->template(
    'template_name',
    'language_code (optional)'

);

echo $response;
```

> Your version should be rounded to one decimal place e.g v19.0 and not v19 The language code is optional here. If empty it will take the default as en\_US

### Send a Text Message

[](#send-a-text-message)

You can only send a template type message as your first message to a user. If you want to send a text message the user must first send a message to you or reply to any of the messages you sent.

```
