Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Interactive reply buttons media header #212

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

derrickobedgiu1
Copy link
Contributor

@derrickobedgiu1 derrickobedgiu1 commented Oct 30, 2024

This PR includes support for button reply media headers (image, video, documents).

It maintains existing text header usage without breaking the code by simply swapping the current text header to an instance of a Text Button Reply Header class.

Reference: https://developers.facebook.com/docs/whatsapp/cloud-api/messages/interactive-reply-buttons-messages/

@derrickobedgiu1 derrickobedgiu1 marked this pull request as ready for review October 30, 2024 16:37
$header = new TextHeader($header);
}

if (!$header instanceof ButtonHeader && $header !== null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this if is not necessary, should you use type hinting in the function:

 public function sendButton(string $to, string $body, ButtonAction $action, ?string | ?ButtonHeader $header = null, ?string $footer = null): Response

src/WhatsAppCloudApi.php Show resolved Hide resolved

class ButtonReplyMessage extends Message
final class ButtonReplyMessage extends Message
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class ButtonReplyMEssage yet exists in previous versions so you cannot convert it to final class because this is a breaking change (if anyone extended this class in our code you'll be breaking it)

@aalbarca aalbarca added the request changes PR reviewed but with request changes label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request changes PR reviewed but with request changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants