I am very much of a beginer and trying to follow django-anymail documentation:
https://anymail.dev/en/stable/quickstart/
Got to a point where I am succesfully sending emails using (sendiblue) and now trying to follow webhook documentation for tracking:
https://anymail.dev/en/stable/sending/tracking/#
I have sucesfully configured webhooks as per here:
https://anymail.dev/en/stable/installation/#webhooks-configuration
On my vercel app I see that I am being hit with successfully to my webhooks:
SEP 28 09:44:52.18
200
django-anymail.vercel.app
[POST] /anymail/sendinblue/tracking/
using Web Server Gateway Interface (WSGI) Message <202309280829.50870869121@smtp-relay.mailin.fr> to dz00nas@gmail.com opened
SEP 28 09:29:51.73
200
django-anymail.vercel.app
[POST] /anymail/sendinblue/tracking/
SEP 28 09:29:51.03
200
django-anymail.vercel.app
[POST] /anymail/sendinblue/tracking/
But now I do not understand how to process these, I tried the following:
- I created a new app called emailtracking
- created signals.py inside emailtracking folder
from anymail.signals import tracking
from django.dispatch import receiver
@receiver(tracking) # add weak=False if inside some other function/class
def handle_bounce(sender, event, esp_name, **kwargs):
if event.event_type == 'bounced':
print("Message %s to %s bounced" % (
event.message_id, event.recipient))
@receiver(tracking) # add weak=False if inside some other function/class
def handle_bounce(sender, event, esp_name, **kwargs):
if event.event_type == 'sent':
print("Message %s to %s sent" % (
event.message_id, event.recipient))
@receiver(tracking) # add weak=False if inside some other function/class
def handle_bounce(sender, event, esp_name, **kwargs):
if event.event_type == 'opened':
print("Message %s to %s opened" % (
event.message_id, event.recipient))