emizoripx / whatsapp-cloudapi
Library for sending Whatsapp messages with the Whatsapp Cloud Api service
v1.0.7
2023-08-18 13:07 UTC
This package is auto-updated.
Last update: 2026-03-15 05:09:38 UTC
README
Package for sending Whatsapp messages with the Whatsapp Cloud Api Service.
Supports
- Send messages with a predefined template.
- Send documents and multimedia.
- Send buttons or links.
- Currently supports sending to a single cell phone number.
Configure
Before use, you must configure the following parameters
- In the
.envfile of the project copy and set the following environment variables
WHATSAPP_CLOUD_API_HOST=
Usage
- To send a message just call the Facade
EmizorIpx\WhatsappMessages\Facades\WhatsappMessageto methodsendWhithTemplateand specify the required parameters
use EmizorIpx\WhatsappCloudapi\Facades\WhatsappCloudapiMessage;
use EmizorIpx\WhatsappCloudapi\Messages\Template\Component;
use EmizorIpx\WhatsappCloudapi\Services\Whatsapp\Settings\WhatsappCloudApiSettings;
...
$cloud_settings = new WhatsappCloudApiSettings( $from_phone_number_id, $access_token );
$components = new Component($header_components, $body_components, $buttons_components);
WhatsappCloudapiMessage::sendMessageWithTemplate($cloud_settings, $phone_number, $template_name, $components);
- Parameters
from_phone_number_idPhone number identifier.access_tokenwhatsapp cloud api services access token.