New types of conversation category break the webhook processing.
Closed this issue · 5 comments
muniter commented
Facebook rolled out today June 1 conversation based pricing and with it the category types.
https://developers.facebook.com/docs/whatsapp/updates-to-pricing
Therefore it started sengind this data in the webhooks:
{
"object": "whatsapp_business_account",
"entry": [
{
"id": "108536708899139",
"changes": [
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
// redacted
"display_phone_number": "5XXXXXXXXXXX",
// redacted
"phone_number_id": "1XXXXXXXXXXXXXX"
},
"statuses": [
{
"id": "wamid.HBgMNTczMjEyMjMyNzczFQIAERgSMzE3RUQ4MTdDQzU2OTZDRTRDAA==",
"status": "delivered",
"timestamp": "1685626673",
// redacted
"recipient_id": "5XXXXXXXXXXX",
"conversation": {
"id": "d488be6b630353e08249383a9a699f64",
"origin": {
"type": "authentication"
}
},
"pricing": {
"billable": true,
"pricing_model": "CBP",
"category": "authentication"
}
}
]
},
"field": "messages"
}
]
}
]
}
This makes the webhook->read()
throw erros not recognizing the type of conversation.
[2023-06-01 13:37:59][LOGGED_OUT][req-64789f37982b5][error][UnexpectedValueException] UnexpectedValueException: Value
'authentication' is not part of the enum Netflie\WhatsAppCloudApi\WebHook\Notification\Support\ConversationType in /ap
p/vendor/myclabs/php-enum/src/Enum.php:245
Stack trace:
#0 /app/vendor/myclabs/php-enum/src/Enum.php(73): MyCLabs\Enum\Enum::assertValidValueReturningKey('authentication')
#1 /app/vendor/netflie/whatsapp-cloud-api/src/WebHook/Notification/Support/Conversation.php(16): MyCLabs\Enum\Enum->__
construct('authentication')
#2 /app/vendor/netflie/whatsapp-cloud-api/src/WebHook/Notification/StatusNotificationFactory.php(21): Netflie\WhatsApp
CloudApi\WebHook\Notification\Support\Conversation->__construct('d488be6b630353e...', 'authentication', NULL)
#3 /app/vendor/netflie/whatsapp-cloud-api/src/WebHook/NotificationFactory.php(33): Netflie\WhatsAppCloudApi\WebHook\No
tification\StatusNotificationFactory->buildFromPayload(Array, Array)
#4 /app/vendor/netflie/whatsapp-cloud-api/src/WebHook.php(32): Netflie\WhatsAppCloudApi\WebHook\NotificationFactory->b
uildFromPayload(Array)
#5 /app/modules/Whatsapp/controllers/DefaultController.php(44): Netflie\WhatsAppCloudApi\WebHook->read(Array)
derrickobedgiu1 commented
True. This needs an urgent fix
aalbarca commented
derrickobedgiu1 commented
The PR solves all the issues. No more errors "service" and "authentication" after testing it.
aalbarca commented
Thanks @derrickobedgiu1 published 2.0.4 release with the fix.
muniter commented
Thanks!! I see the errors gone in my application after upgrading. Using service and authentication.