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

Retrieve existing WhatsApp Templates & enums #189

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

Conversation

likeabas
Copy link

@likeabas likeabas commented Apr 19, 2024

This change allows to request all available templates. The WHATSAPP_CLOUD_API_BUSINESS_ID should be set to make it work.

It touches upon #182

@likeabas likeabas changed the title Template request option WIP: Template request option Apr 19, 2024
@likeabas likeabas marked this pull request as draft April 19, 2024 14:13
@likeabas likeabas changed the title WIP: Template request option Retrieve existing WhatsApp Templates & enums Aug 13, 2024
@likeabas likeabas marked this pull request as ready for review August 13, 2024 08:30
@likeabas
Copy link
Author

@aalbarca I've added a method to request whatsapp templates. Furthermore, I've used enums and updated the requirements to PHP => 8.1 (as PHP 7 is no longer supported), so it should probably mean a version bump.
Furthermore, I've updated the docs a bit.

@likeabas
Copy link
Author

@aalbarca do you know how I can update the PHP version of the CI?

@HighLiuk
Copy link

Hey there @likeabas thank you for this contribution this is exactly what I needed.

@aalbarca I've added a method to request whatsapp templates. Furthermore, I've used enums and updated the requirements to PHP => 8.1 (as PHP 7 is no longer supported), so it should probably mean a version bump.
Furthermore, I've updated the docs a bit.

I don't think this will be merged if the author @aalbarca still wants to support PHP 7.4. And if you ask me, I love the most recent versions of PHP, but you can't always update your PHP version if you are in production. PHP 7.4 is still widespread and supporting it still matters in 2024.

How about rolling back the "enum" part? Note the author is already using a PHP package that allows you to use enums as if they were PHP 8.0 native enums. See this for instance.
I assume that supporting only PHP 8.0 would require you to refactor the whole code with native enums (and I assume it should be a separate issue / PR / milestone).

Nevertheless, this PR is awesome. @aalbarca what do you think of it?

@HighLiuk
Copy link

By the way @likeabas aren't template status & template category different?

If you see the official Meta Docs, you can pass both indeed.

Quoting the docs:

Category

array<enum {ACCOUNT_UPDATE, PAYMENT_UPDATE, PERSONAL_FINANCE_UPDATE, SHIPPING_UPDATE, RESERVATION_UPDATE, ISSUE_RESOLUTION, APPOINTMENT_UPDATE, TRANSPORTATION_UPDATE, TICKET_UPDATE, ALERT_UPDATE, AUTO_REPLY, TRANSACTIONAL, OTP, UTILITY, MARKETING, AUTHENTICATION}>

Status

array<enum {APPROVED, IN_APPEAL, PENDING, REJECTED, PENDING_DELETION, DELETED, DISABLED, PAUSED, LIMIT_EXCEEDED, ARCHIVED}>

@HighLiuk
Copy link

@likeabas also, typo here. $example should be $exampleStrings I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants