# `PhoenixKit.Modules.Emails.BrevoEventNormalizer`
[🔗](https://github.com/BeamLabEU/phoenix_kit_emails/blob/0.4.2/lib/phoenix_kit/modules/emails/brevo_event_normalizer.ex#L1)

Normalizes a single event from Brevo's `GET /v3/smtp/statistics/events`
response into the same event-data shape `SQSProcessor.process_email_event/1`
already accepts for AWS SES — see that function's `@doc` for the exact
contract. `SQSProcessor` itself is untouched: every `process_*_event/1`
function stays SES-shaped, this module's only job is translating Brevo's
vocabulary into it.

A raw Brevo event looks like:

    %{
      "date" => "2017-03-12T12:30:00Z",
      "email" => "john.smith@example.com",
      "event" => "delivered",
      "messageId" => "<201798300811.5787683@example.domain.com>",
      "reason" => "...",       # bounces/blocked/invalid/error only
      "link" => "...",         # clicks only
      "ip" => "..."            # opened/clicks only
    }

`date` is already full ISO 8601 with a `Z` offset — `SQSProcessor`'s own
`parse_timestamp/1` (`DateTime.from_iso8601/1`) accepts it unmodified, no
reformatting needed.

# `normalize`

```elixir
@spec normalize(map()) :: {:ok, map()} | :ignore | {:error, term()}
```

Normalizes a raw Brevo event.

## Returns

- `{:ok, event_data}` — ready for `SQSProcessor.process_email_event/1`
- `:ignore` — a Brevo `"requests"` event (the send-request acknowledgement;
  we already log our own "send" event at send time, so this carries
  nothing new)
- `{:error, reason}` — missing required fields, or an event type Brevo
  added since this mapping was written

---

*Consult [api-reference.md](api-reference.md) for complete listing*
