Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
derrickobedgiu1 committed Oct 30, 2024
1 parent 3493c6a commit 1ae0691
Showing 1 changed file with 49 additions and 2 deletions.
51 changes: 49 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,13 @@ $whatsapp_cloud_api->sendCatalog(
```

### Send a button reply message

Button reply with Text Header
```php
<?php

use Netflie\WhatsAppCloudApi\WhatsAppCloudApi;
use Netflie\WhatsAppCloudApi\Message\ButtonReply\Button;
use Netflie\WhatsAppCloudApi\Message\ButtonReply\TextHeader;
use Netflie\WhatsAppCloudApi\Message\ButtonReply\ButtonAction;

$whatsapp_cloud_api = new WhatsAppCloudApi([
Expand All @@ -288,15 +289,61 @@ $rows = [
];
$action = new ButtonAction($rows);

$header = new TextHeader('RATE US');

$whatsapp_cloud_api->sendButton(
'<destination-phone-number>',
'Would you like to rate us on Trustpilot?',
$action,
'RATE US', // Optional: Specify a header (type "text")
$header, // Optional, can be text, image, video, or document
'Please choose an option' // Optional: Specify a footer
);
```

Button Reply with Image Header
```php
use Netflie\WhatsAppCloudApi\Message\ButtonReply\ImageHeader;
use Netflie\WhatsAppCloudApi\Message\Media\LinkID;

$link_id = new LinkID('http(s)://image-url');
$header = new ImageHeader($link_id);

//or

$media_id = new MediaObjectID('<image-object-id>');
$header = new ImageHeader($media_id);
```

Button Reply with Video Header
```php
use Netflie\WhatsAppCloudApi\Message\ButtonReply\VideoHeader;
use Netflie\WhatsAppCloudApi\Message\Media\LinkID;

$link_id = new LinkID('http(s)://video-url');
$header = new VideoHeader($link_id);

//or

$media_id = new MediaObjectID('<video-object-id>');
$header = new VideoHeader($media_id);
```

Button Reply with Document Header
```php
use Netflie\WhatsAppCloudApi\Message\ButtonReply\DocumentHeader;
use Netflie\WhatsAppCloudApi\Message\Media\LinkID;

$filename = 'whatsapp-cloud-api-from-url.pdf';
$link_id = new LinkID('http(s)://document-url');
$header = new DocumentHeader($link_id);

//or

$filename = 'whatsapp-cloud-api-from-id.pdf';
$media_id = new MediaObjectID('<document-object-id>');
$header = new DocumentoHeader($media_id,);
```

### Send Multi Product Message
```php
<?php
Expand Down

0 comments on commit 1ae0691

Please sign in to comment.