mathsgod/whatsapp-client

A PHP client for WhatsApp API

1.0.0 2023-07-04 04:35 UTC

This package is auto-updated.

Last update: 2024-11-04 12:03:14 UTC


README

Description

This is a simple WhatsApp client that uses the WhatsApp Web API to send and receive messages.

Installation

composer require mathsgod/whatsapp-client

Usage

You can generate token from https://business.facebook.com/settings/system-users/

Phone number id is not phone number, find it in https://developers.facebook.com/apps/{app_id}/whatsapp-business/wa-dev-console/

Send a text message

$wa = new WhatsApp\Client($token, $phone_number_id);

$wa->sendText("85298765432","Hello World!");

Send a document

$wa = new WhatsApp\Client($token, $phone_number_id);

$wa->sendDocument("85298765432",$url,"document.pdf");