Description
Symfony version(s) affected
6.4.0+
Description
This part of Brevo webhook
andmessage-id
to be part of the webhook payload from Brevo. That key is only included in the payload from transactional-webhooks
https://developers.brevo.com/docs/transactional-webhooks and not from
marketing-webhooks
https://developers.brevo.com/docs/marketing-webhooks so the incoming request fail with HTTP 406.
Can we remove this requirement or add conditional check based on webhook type (I dont see any good way to determine this).
How to reproduce
composer require symfony/webhook
composer require symfony/mailer
composer require symfony/brevo-mailer
Follow https://symfony.com/doc/current/webhook.html and also add:
# config/packages/framework.yaml
framework:
webhook:
routing:
brevo:
service: 'mailer.webhook.request_parser.brevo'
Then send POST localhost/webhook/brevo
with payload:
curl --request POST \
--url http://localhost/webhook/brevo \
--data '{
"id": 1239108,
"camp_id": 960,
"email": "[email protected]",
"campaign name": "Name of camaign",
"date_sent": "2024-11-13 17:03:03",
"date_event": "2024-12-13 10:36:06",
"tag": "",
"URL": "https://example.com/clickclick",
"event": "click",
"ts": 1734082566,
"ts_event": 1734082566,
"ts_sent": 1731513783
}'
{
"type": "https://tools.ietf.org/html/rfc2616#section-10",
"title": "An error occurred",
"status": 406,
"detail": "Payload is malformed.",
"class": "Symfony\\Component\\Webhook\\Exception\\RejectWebhookException"
...
}
Possible Solution
Remove this requirement
|| !isset($content['message-id'])
and change it here
$event = new MailerEngagementEvent($name, $payload['message-id'], $payload);
Maybe it would be possible to change message-id
to id
instead, as it seems to be included in both transactional and marketing webhook payloads but Im not familiar with the purpose of message-id
specifically. I just recently started using Brevo.
Additional Context
No response