bariew/whatsapp

Whatsapp API

dev-main 2025-08-28 14:03 UTC

This package is not auto-updated.

Last update: 2025-08-29 12:31:35 UTC


README

Whatsapp API client.

Description

  • send messages
  • create templates
  • receive media

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist bariew/whatsapp

or add

"bariew/whatsapp": "dev-master"

to the require section of your composer.json file.

Usage

$whatsapp = Api::instance($id, $token, $business_id);
$templateId = $whatsapp->templateCreate("template1_en", "Hello {{username}}", "", "From My App", [
    "https://my.url" => "click this url",
    "my_key" => "Ok"
], 'en');

$messageId = $whatsapp->templateMessage('+9-900-033-44-16', 'template1_en', ['username' => "Paul"])['messages'][0]['id'];

see more examples in Api::webhookProcess()
since most actions happen when user answers to our messages and we need to process the answer in our webhook