From e3b33f73cd4572a192924bed74f0471ce7cf6154 Mon Sep 17 00:00:00 2001 From: derrickobedgiu1 Date: Sun, 17 Mar 2024 14:30:48 +0300 Subject: [PATCH] Modify README --- README.md | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ab088f8..c4bb2a1 100644 --- a/README.md +++ b/README.md @@ -179,6 +179,14 @@ $whatsapp_cloud_api->sendSticker('', $media_id); $whatsapp_cloud_api->sendLocation('', $longitude, $latitude, $name, $address); ``` +### Send a location request message +```php +sendLocationRequest('', $body); +``` + ### Send a contact message ```php @@ -228,7 +236,7 @@ $whatsapp_cloud_api->sendList( "RATE US" ]; -$buttonHeader = new ButtonHeader('text',$payload); +$buttonHeader = new Header('text',$payload); // image or video header $payload = [ 'id' => "277147652084836" //or 'link' => "http(s)://image-or-video-url" ]; -$buttonHeader = new ButtonHeader('image',$payload); //or 'video' +$buttonHeader = new Header('image',$payload); //or 'video' // document header $payload = [ @@ -262,7 +270,7 @@ $payload = [ //or 'link' => "http(s)://document-url", 'filename' => "Document-name.ext" ]; -$buttonHeader = new ButtonHeader('document',$payload); +$buttonHeader = new Header('document',$payload); $action = new ButtonAction($rows, $buttonHeader); // $buttonHeader is optional @@ -334,6 +342,84 @@ $whatsapp_cloud_api->sendReaction( ); ``` +## Catalogs, Products +### Send Catalog Message +```php +'; // product sku id to use as header thumbnail + +$whatsapp_cloud_api->sendCatalog( + '', + $body, + $footer, // optional + $sku_thumbnail // optional +); +``` + +### Send Single Product Message +```php +'; +$sku_id = ''; +$body = 'Hello! Here\'s your requested product. Thanks for shopping with us.'; +$footer = 'Subject to T&C'; + +$whatsapp_cloud_api->sendSingleProduct( + '', + $catalog_id, + $sku_id, + $body, // body: optional + $footer // footer: optional +); +``` + +### Send Multi Product Message +```php +'), + new Row(''), + // etc +]; + +$rows_section_2 = [ + new Row(''), + new Row(''), + new Row(''), + // etc +]; + +$sections = [ + new Section('Section 1', $rows_section_1), + new Section('Section 2', $rows_section_2), +]; + +$action = new Action($sections); +$catalog_id = ''; +$header = 'Grocery Collections'; +$body = 'Hello! Thanks for your interest. Here\'s what we can offer you under our grocery collection. Thank you for shopping with us.'; +$footer = 'Subject to T&C'; + +$whatsapp_cloud_api->sendMultiProduct( + '', + $catalog_id, + $action, + $header, + $body, + $footer // optional +); +``` + ## Media messages ### Upload media resources Media messages accept as identifiers an Internet URL pointing to a public resource (image, video, audio, etc.). When you try to send a media message from a URL you must instantiate the `LinkID` object.