mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
SendinBlue: additional template/tags improvements
Additional changes related to SendinBlue improvements in #158: * Support multiple tags in webhooks (closes #162) * Remove additional outdated template code in backend * Update integration tests * Update docs and changelog; note breaking changes as discussed in #161
This commit is contained in:
@@ -83,12 +83,8 @@ class SendinBluePayload(RequestsPayload):
|
||||
|
||||
def serialize_data(self):
|
||||
"""Performs any necessary serialization on self.data, and returns the result."""
|
||||
|
||||
if not self.data['headers']:
|
||||
del self.data['headers'] # don't send empty headers
|
||||
if self.data.get('templateId') and (self.data.pop('textContent', False) or self.data.pop('htmlContent', False)):
|
||||
self.unsupported_feature("overriding template body content")
|
||||
|
||||
return self.serialize_json(self.data)
|
||||
|
||||
#
|
||||
|
||||
@@ -49,10 +49,17 @@ class SendinBlueTrackingWebhookView(AnymailBaseWebhookView):
|
||||
except (KeyError, ValueError):
|
||||
timestamp = None
|
||||
|
||||
tags = []
|
||||
try:
|
||||
tags = [esp_event["tag"]]
|
||||
# If `tags` param set on send, webhook payload includes 'tags' array field.
|
||||
tags = esp_event['tags']
|
||||
except KeyError:
|
||||
tags = []
|
||||
try:
|
||||
# If `X-Mailin-Tag` header set on send, webhook payload includes single 'tag' string.
|
||||
# (If header not set, webhook 'tag' will be the template name for template sends.)
|
||||
tags = [esp_event['tag']]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
try:
|
||||
metadata = json.loads(esp_event["X-Mailin-custom"])
|
||||
|
||||
Reference in New Issue
Block a user