Search code examples
emailsendgridsendgrid-api-v3

How does SendGrid notify (delivered-open-click) events when multiple email recipients are specified


When you send an email through sendgrid, and the recipient opens the email, SendGrid will notify my server about that using webhooks (open) event. https://docs.sendgrid.com/for-developers/tracking-events/event

But what happens if I specify multiple recipients for the same email with personalizations, do I get the same (open) event every time one of the recipients opens that email? If so how can my server figure which recipient?

What about the (delivered) event? Same questions.


Solution

  • Twilio SendGrid developer evangelist here.

    The best way I found to achieve this is to send custom_args with the email, you can add custom_args to each individual personalisation object. Parameters set in custom_args are also sent along in the event webhook.

    I wrote a post about how to use custom_args to track email statuses. The post uses Ruby on Rails as the framework, but covers using custom_args and reading them back in the event webhook to update the email in your own database.