sendgridsendgrid-api-v3

SendGrid "delivered" event missing


When using the SendGrid email api in combination with a webhook to receive events we sometimes get the following situation:

  1. An email message is accepted by SendGrid and a webhook event is received with status "processed"
  2. We receive an "opened" event, without ever receiving a "delivered" event

So it seems that for some messages the "delivered" event is not sent, even though the email has clearly been delivered.

Did anyone have a similar experience? Is it a technical limitation within SendGrid that needs to be mitigated locally?

Thanks in advance!


Solution

  • As I currently found out, SendGrid sometimes sends multiple status changes in the same Webhook body in an array.

    For example

    {[..."event":"delivered"...,"timestamp":1701773263], [..."event":"processed"...,"timestamp":1701773261]}
    

    As you can see here, the array is sorted with latest event first.

    If you just parse this array and iterate over it, you may override the previous state (which actually would be the newer one)