You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mailgun now strips the X-Mailgun-Variables header from the message-headers field for clicked/opened and possibly other events. (Strangely not for delivered)
There is now a user-variables dictionary that contains the meta data.
The text was updated successfully, but these errors were encountered:
So it seems user-variables is only shown in their log.
The source code comment: "Mailgun merges metadata fields with the other event fields." is still true
BUT "However, it also includes the original message headers which have the metadata separately as X-Mailgun-Variables." is not true for opened and clicked events, for some reason they strip the X-Mailgun-Variables header!
Mailgun's approach of merging "custom variables" directly into the posted event is really... inconvenient. Among other issues, it means you must avoid choosing custom variable names that could conflict with any current or future Mailgun tracking event properties if you want to access those variables from a webhook.
I'm starting to think the only way for Anymail to (semi-)reliably recover metadata (custom user-variables) from a Mailgun tracking event is to just include all event data that doesn't match a known Mailgun property. It'll be a little fragile -- if/when Mailgun adds new event properties, Anymail will think those are metadata until it's updated. I'll look at making that change.
A useful Mailgun feature request would be for them to include the 'user-variables' event property in the fields posted to tracking webhooks. (user-variables is available through their events API; it's just not posted to the webhooks in un-merged form.)
BTW, a workaround in your event hook is to access the raw Mailgun esp_event fields directly. If your metadata field is named "user1", the value will be available in a Mailgun tracking webhook as event.esp_event["user1"].
(This won't be portable if you ever switch ESPs, of course.)
Mailgun now strips the X-Mailgun-Variables header from the message-headers field for clicked/opened and possibly other events. (Strangely not for delivered)
There is now a user-variables dictionary that contains the meta data.
The text was updated successfully, but these errors were encountered: