Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page

Event Webhook Reference


(warning)

Secure Event Webhook data in production

To secure the Event Webhook data, use the Signed Event Webhook, OAuth 2.0, or both.

Twilio stores categories and unique arguments in a field that shouldn't include personally identifiable information (PII). Twilio might use these categories and arguments for counting or other operations as SendGrid runs its systems. You can't redact or remove these fields. Never place PII in this field. Twilio SendGrid doesn't treat this data as PII. Twilio employees could see these values. These values get stored long-term even if you leave the Twilio SendGrid platform.

To learn more about Event Webhook security, see Getting Started with the Event Webhook Security Features.


Events

events page anchor

When Twilio SendGrid and email service providers process email messages, these messages generate events that Twilio logs. Twilio tracks three types of events: delivery, engagement, and account.

  • Delivery events that indicate the status of email delivery to the recipient.
  • Engagement events that indicate how the recipient is interacting with the email.
  • Account change events that indicate changes and impacts to your account.

Delivery events cover messages that were bounced, delivered, deferred, dropped, or processed.

Expected properties for delivery events

expected-properties-for-delivery-events page anchor

The following table identifies the properties each delivery type returns:

PropertyBounceDeliveredDeferredDroppedProcessed
asm_group_idXXXXX
bounce_classificationX
attemptX
categoryXXXXX
emailXXXXX
eventXXXXX
ipX
marketing_campaign_idXXXXX
marketing_campaign_nameXXXXX
poolX
reasonXXX
responseX
sg_event_idXXXXX
sg_message_idX*XXXX
smtp-idXXXXX
statusX
timestampXXXXX
tlsXX
unique_argsXXXXX

* In the case of a delayed or asynchronous bounce, Twilio doesn't return the message ID.

Bounce and blocked events

bounce-and-blocked-events page anchor

Events can return two types of bounces: a bounce, a permanent delivery denial, or a block, a temporary delivery denial.

Bounce type of Bounce event

bounce-type-of-bounce-event page anchor

The receiving server doesn't accept mail sent to this recipient. Twilio refers to this Bounce event type as a hard bounce ("type": "bounce"). If a recipient unsubscribed from your emails, Twilio SendGrid drops the message.

Example bounced event webhook response

example-bounced-event-webhook-response page anchor
1
[
2
{
3
"email": "alex@example.com",
4
"timestamp": 1513299569,
5
"smtp-id": "<14c5d75ce93.dfd.64b469@ismtpd-555>",
6
"bounce_classification": "Invalid Address",
7
"event": "bounce",
8
"category": "cat facts",
9
"sg_event_id": "6g4ZI7SA-xmRDv57GoPIPw==",
10
"sg_message_id": "14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0",
11
"reason": "500 unknown recipient",
12
"status": "5.0.0",
13
"type": "bounce"
14
}
15
]

Blocked type of Bounce event

blocked-type-of-bounce-event page anchor

The receiving server can't accept the message at this time. Twilio refers to this Bounce event type as a soft bounce ("type": "blocked"). The receiving server might accept the blocked message at a later time.

Example webhook response for blocked events

example-webhook-response-for-blocked-events page anchor
1
[
2
{
3
"email": "alex@example.com",
4
"timestamp": 1513299569,
5
"smtp-id": "<14c5d75ce93.dfd.64b469@ismtpd-555>",
6
"bounce_classification": "Invalid Address",
7
"event": "bounce",
8
"category": "cat facts",
9
"sg_event_id": "6g4ZI7SA-xmRDv57GoPIPw==",
10
"sg_message_id": "14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0",
11
"reason": "500 unknown recipient",
12
"status": "5.0.0",
13
"type": "blocked"
14
}
15
]

The bounce_classification property accepts the following values:

To learn the details about these values, see Bounce and Block Classifications.

Twilio SendGrid succeeded in delivering the message to the receiving server.

Example delivered event webhook response

example-delivered-event-webhook-response page anchor
1
[
2
{
3
"email": "alex@example.com",
4
"timestamp": 1513299569,
5
"smtp-id": "<14c5d75ce93.dfd.64b469@ismtpd-555>",
6
"event": "delivered",
7
"category": "cat facts",
8
"sg_event_id": "rWVYmVk90MjZJ9iohOBa3w==",
9
"sg_message_id": "14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0",
10
"response": "250 OK"
11
}
12
]

The receiving server rejected the message temporarily.

Example deferred event webhook response

example-deferred-event-webhook-response page anchor
1
[
2
{
3
"email": "alex@example.com",
4
"domain": "example.com",
5
"from": "test@example.com",
6
"timestamp": 1513299569,
7
"smtp-id": "<14c5d75ce93.dfd.64b469@ismtpd-555>",
8
"event": "deferred",
9
"category": "cat facts",
10
"sg_event_id": "t7LEShmowp86DTdUW8M-GQ==",
11
"sg_message_id": " 14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0",
12
"response": "400 try again later",
13
"attempt": "5"
14
}
15
]

Twilio SendGrid dropped the message for one of the following reasons:

  • Invalid SMTPAPI header
  • Spam Content (if you turned on the Spam Checker app)
  • Unsubscribed Address
  • Bounced Address
  • Spam Reporting Address
  • Invalid Address
  • Recipient List over Package Quota

Example dropped event webhook response

example-dropped-event-webhook-response page anchor
1
[
2
{
3
"email": "alex@example.com",
4
"timestamp": 1513299569,
5
"smtp-id": "<14c5d75ce93.dfd.64b469@ismtpd-555>",
6
"event": "dropped",
7
"category": "cat facts",
8
"sg_event_id": "zmzJhfJgAfUSOW80yEbPyw==",
9
"sg_message_id": "14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0",
10
"reason": "Bounced Address",
11
"status": "5.0.0"
12
}
13
]

Twilio SendGrid accepted and can deliver the message.

Example processed event webhook response

example-processed-event-webhook-response page anchor
1
[
2
{
3
"email": "alex@example.com",
4
"timestamp": 1513299569,
5
"pool": {
6
"name": "new_MY_test",
7
"id": 210
8
},
9
"smtp-id": "<14c5d75ce93.dfd.64b469@ismtpd-555>",
10
"event": "processed",
11
"category": "cat facts",
12
"sg_event_id": "rbtnWrG1DVDGGGFHFyun0A==",
13
"sg_message_id": "14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.000000000000000000000"
14
}
15
]

Engagement events include open, click, spam report, unsubscribe, group unsubscribe, and group resubscribe.

Expected properties for engagement events

expected-properties-for-engagement-events page anchor

The following table identifies the properties each engagement event type returns:

PropertyOpenedClickedSpam reportUnsubscribeGroup unsubscribeGroup resubscribe
asm_group_idXXXX
categoryXXXX
emailXXXXXX
eventXXXXXX
ipXXXX
marketing_campaign_idXXXXXX
marketing_campaign_nameXXXXXX
sg_event_idXXXXXX
sg_machine_openX
sg_message_idXXXXXX
timestampXXXXXX
urlX
url_offsetX
useragentXXXX
unique_argsXXXXXX

Recipient clicked on a link within the message. To track clicks, turn on Click Tracking.

Example webhook response for click events

example-webhook-response-for-click-events page anchor
1
[
2
{
3
"sg_event_id": "sendgrid_internal_event_id",
4
"sg_message_id": "sendgrid_internal_message_id",
5
"ip": "255.255.255.255",
6
"useragent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53",
7
"event": "click",
8
"email": "email@example.com",
9
"timestamp": 1249948800,
10
"url": "http://example.com/blog/news.html",
11
"url_offset": {
12
"index": 0,
13
"type": "html"
14
},
15
"unique_arg_key": "unique_arg_value",
16
"category": ["category1", "category2"],
17
"newsletter": {
18
"newsletter_user_list_id": "10557865",
19
"newsletter_id": "1943530",
20
"newsletter_send_id": "2308608"
21
},
22
"asm_group_id": 1
23
}
24
]

Recipient has opened the HTML message. To track opens, turn on Open Tracking.

Example webhook response for open events

example-webhook-response-for-open-events page anchor
1
[
2
{
3
"email": "alex@example.com",
4
"timestamp": 1513299569,
5
"event": "open",
6
"sg_machine_open": false,
7
"category": "cat facts",
8
"sg_event_id": "FOTFFO0ecsBE-zxFXfs6WA==",
9
"sg_message_id": "14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0",
10
"useragent": "Mozilla/4.0 (compatible; MSIE 6.1; Windows XP; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
11
"ip": "255.255.255.255"
12
}
13
]

Recipient marked message as spam.

Example webhook response for spam report events

example-webhook-response-for-spam-report-events page anchor
1
[
2
{
3
"email": "alex@example.com",
4
"timestamp": 1513299569,
5
"smtp-id": "<14c5d75ce93.dfd.64b469@ismtpd-555>",
6
"event": "spamreport",
7
"sg_event_id": "37nvH5QBz858KGVYCM4uOA==",
8
"sg_message_id": "14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0"
9
}
10
]

Recipient clicked on the Opt Out of All Emails link. To track subscriptions, turn on Subscription Tracking.

Example webhook response for unsubscribe events

example-webhook-response-for-unsubscribe-events page anchor
1
[
2
{
3
"email": "alex@example.com",
4
"timestamp": 1513299569,
5
"event": "unsubscribe",
6
"category": "cat facts",
7
"sg_event_id": "zz_BjPgU_5pS-J8vlfB1sg==",
8
"sg_message_id": "14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0"
9
}
10
]

Group resubscribe events

group-resubscribe-events page anchor

Recipient resubscribed to a specific group by updating their preferences. To track subscriptions, turn on Subscription Tracking.

Example webhook response for group resubscribe events

example-webhook-response-for-group-resubscribe-events page anchor
1
[
2
{
3
"email": "alex@example.com",
4
"timestamp": 1513299569,
5
"smtp-id": "<14c5d75ce93.dfd.64b469@ismtpd-555>",
6
"event": "group_resubscribe",
7
"category": "cat facts",
8
"sg_event_id": "w_u0vJhLT-OFfprar5N93g==",
9
"sg_message_id": "14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0",
10
"useragent": "Mozilla/4.0 (compatible; MSIE 6.1; Windows XP; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
11
"ip": "255.255.255.255",
12
"url": "http://www.example.com/",
13
"asm_group_id": 10
14
}
15
]

Group unsubscribe events

group-unsubscribe-events page anchor

Recipient unsubscribed from a specific group. The recipient clicked an unsubscribe link or updated their preferences. To track subscriptions, turn on Subscription Tracking.

Example webhook response for group unsubscribe events

example-webhook-response-for-group-unsubscribe-events page anchor
1
[
2
{
3
"email": "alex@example.com",
4
"timestamp": 1513299569,
5
"smtp-id": "<14c5d75ce93.dfd.64b469@ismtpd-555>",
6
"event": "group_unsubscribe",
7
"category": "cat facts",
8
"sg_event_id": "ahSCB7xYcXFb-hEaawsPRw==",
9
"sg_message_id": "14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0",
10
"useragent": "Mozilla/4.0 (compatible; MSIE 6.1; Windows XP; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
11
"ip": "255.255.255.255",
12
"url": "http://www.example.com/",
13
"asm_group_id": 10
14
}
15
]

Account status change events

account-status-change-events page anchor

Your account status changed because of issues related to compliance with the Twilio SendGrid terms of service(link takes you to an external page). This can happen when Twilio SendGrid identifies abnormal activity such as phishing, elevated spam rates, or other bad behavior.

Expected properties for account status change events

expected-properties-for-account-status-change-events page anchor

The following table identifies the properties each account status change event returns:

PropertyAccount status change
eventX
sg_event_idX
timestampX
typeX

Example webhook response for account status change events

example-webhook-response-for-account-status-change-events page anchor
1
[
2
{
3
"event":"account_status_change",
4
"sg_event_id":"MjEzNTg5OTcyOC10ZXJtaW5hdGUtMTcwNzg1MTUzMQ",
5
"timestamp":1709142428,
6
"type":"compliance_suspend"
7
}
8
]

To learn more about account statuses, see Account Under Review.


PropertyTypeDescription
asm_group_idStringUnique ID attached to the unsubscribe group. It includes the recipient's email address.
attemptIntegerNumber of times Twilio SendGrid attempted to deliver this message.
bounce_classificationStringGrouping of Simple Mail Transfer Protocol (SMTP) failure messages into classifications.
Expects: Invalid Address, Technical, Content, Reputation, Frequency/Volume, Mailbox Unavailable, or Unclassified.
categoryStringCustom tags set to organize your emails. If you send single categories as an array, the webhook returns them as an array. If you send single categories as a string, the webhook returns them as a string.
emailStringEmail address to which Twilio SendGrid sent the message.
eventEnum(String)Type of occurrence that triggered this event.
Expects: processed, dropped, delivered, deferred, bounce, open, click, spam report, unsubscribe, group_unsubscribe, and group_resubscribe.
ipStringIP address used to send the email. For open and click events, the IP address of the recipient who engaged with the email. Certain events don't return the IP address in the response.
reasonStringError response that the receiving server returned. The response describes what occurrence triggered this event.
responseStringFull text of the HTTP response error returned from the receiving server.
statusStringThree digits, formatted as string X.Y.Z, that corresponds to HTTP status code XYZ.
sg_event_idStringUnique ID that Twilio attached to this event. These URL-safe IDs can be no more than 100 characters long. Use this ID for deduplication purposes.
sg_machine_openBooleanFlag that indicates whether or not Apple Mail Privacy Protection (MPP) generated an open event.
sg_message_idStringUnique ID that Twilio attached to this message.
smtp-idStringUnique ID that the originating system attached to the message.
timestampStringDate and time when the event occurred, expressed as a UNIX timestamp(link takes you to an external page).
tlsBooleanFlag that indicates whether the message was sent with TLS encryption.
typeStringDefines the kind of bounce and account status change events.
urlStringURL where the event originates. For click events, this is the URL clicked on by the recipient.
url_offsetIntegerZero-based index for the location of a link in the message's HTML code. Each duplicate URL has a unique index number.
useragentStringUser agent or program that generated the event.
unique_argsObjectSMTP API or v2 Mail Send use unique arguments.
custom_argsObjectv3 Mail Send uses custom arguments.

ID of the unsubscribe group that includes the recipient's email address. When you create an unsubscribe group, Advanced Suppression Management (ASM) Group IDs correspond to the ID returned.

Number of times Twilio SendGrid attempted to deliver this message.

bounce_classification property

bounce_classification-property page anchor

Grouping of SMTP failure messages into classifications. Expected values include Invalid Address, Technical, Content, Reputation, Frequency/Volume, Mailbox Unavailable, or Unclassified.

To learn more about these classifications, see Bounce and Block Classifications.

To organize your emails, set these custom tags. If you send single categories as an array, the webhook returns them as an array. If you send single categories as a string, the webhook returns them as a string.

1
[
2
{
3
"email": "alex@example.com",
4
"timestamp": 1337966815,
5
"category": "newuser",
6
"event": "open"
7
},
8
{
9
"email": "bobby@example.com",
10
"timestamp": 1337966815,
11
"category": "olduser",
12
"event": "open"
13
}
14
]
1
[
2
{
3
"email": "alex@example.com",
4
"timestamp": 1337966815,
5
"category": ["newuser", "transactional"],
6
"event": "open"
7
},
8
{
9
"email": "bobby@example.com",
10
"timestamp": 1337966815,
11
"category": "olduser",
12
"event": "open"
13
}
14
]

Email address to which Twilio SendGrid sent the message.

Type of occurrence that triggered this event. This property expects: bounce, click, deferred, delivered, dropped, group_resubscribe, group_unsubscribe, open, processed, spam report, and unsubscribe

IP address used to send the email.

  • The open and click events return the IP address of the recipient who engaged with the email.
  • The bounce and deferral events don't return the IP address.
    • During an internal deferral, Twilio takes no action. Without an action, Twilio logs no IP. When Twilio SendGrid determines an issue at a specific MX record, an internal deferral occurs. Before trying to deliver more mail, the service awaits the issue resolution.
    • When Twilio accepts a message for delivery but rejects it after the SMTP conversation ends, a delayed bounce occurs. Without the SMTP conversation, another conversation starts without much of the previous context. Therefore, delayed bounces lack an IP address and other data.

If Twilio sends messages from a specified IP Pool, the webhook returns the IP Pool for a processed event.

1
[
2
{
3
"email": "alex@example.com",
4
"smtp-id": "<14c583da911.2c36.1c804d@ismtpd-073>",
5
"timestamp": 1427409578,
6
"pool": {
7
"name": "new_MY_test",
8
"id": 210
9
},
10
"sg_event_id": "RHFZB1IrTD2Y9Q7bUdZxUw",
11
"sg_message_id": "14c583da911.2c36.1c804d.filter-406.22375.55148AA99.0",
12
"event": "processed"
13
}
14
]

Error response that the receiving server returned. The response describes what occurrence triggered this event.

Full text of the HTTP response error returned from the receiving server.

Unique ID that Twilio attached to this event. These URL-safe IDs can exceed 100 characters. Use this ID for deduplication purposes.

sg_machine_open property

sg_machine_open-property page anchor

Boolean flag that indicates whether or not Apple Mail Privacy Protection (MPP) generated an open event.

Unique ID that Twilio attached to this message. The first half of this ID comes from the smtp-id. The events include the message ID except in delayed or asynchronous bounces.

Unique ID that the originating system attached to the message.

Three digits, formatted as string X.Y.Z, that corresponds to HTTP status code XYZ.

Date and time when the event occurred, expressed as a UNIX timestamp(link takes you to an external page).

Flag that indicates whether the message was sent with TLS encryption.

Defines the kind of bounce and account status change event.

Indicates the kind of the bounce event, either a hard bounce ("type": "bounce") or block ("type": "blocked").

In an account status change event

in-an-account-status-change-event page anchor

Kind of event that triggered a status change for a user for compliance reasons. When a user account changes to a particular status type, the actions that get triggered display in the following table.

Twilio SendGrid action based on typecompliance_suspendcompliance_deactivatecompliance_banreactivate
Blocks delivery of user messagesXXX
Queues messages, but bounces at delivery timeX
Rejects mail queuesXX
Deletes queued messagesXX
Bans user after 48 hoursX
Removes access to the Twilio SendGrid consoleX
Cancels billingX
Removes assigned IP addressesX
Restores user account to active statusX

URL where the event originates. For click events, the recipient clicked this URL.

Zero-index integer that identifies the order in which a URL occurs in the message's HTML code. The first link has an index value of 0. To help identify a link when reviewing metrics like clicks, Twilio provides the url_offset. This allows you to identify each instance of one link. The one closer to the top have a lower url_offset value. Twilio assigns the index based on the link location in the HTML and not based on the link URL.

(information)

How url_offset works

Consider when the links in your email occur in the following order: example.com, example.net, example.com, example.org, example.com. Each link has an index relative to the links appearing before and after it without regard to the link URL. This sets the index values for example.com to 0, 2, and 4. The index value for example.net gets set to 1 and the index value for example.org gets set to 3.

Link URLIndex value
example.com0
example.net1
example.com2
example.org3
example.com4

User agent or program that generated the event. The typical agent is a web browser.

For example:

  • Chrome on macOS: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36
  • Safari on macOS: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0.1 Safari/605.1.15

Unique argument and custom argument properties

unique-argument-and-custom-argument-properties page anchor

The events that Twilio SendGrid generates can include unique arguments or custom arguments. Unique arguments and custom arguments serve the same function.

To define and receive unique arguments when sending email with the SMTP API or the v2 Mail Send endpoint, use the unique_args parameter in the X-SMTPAPI header.

For example: To receive custom parameters such as the userid and the email template, submit them with the X-SMTPAPI header.

(information)

Example of unique arguments in v2 Mail Send API call

If you include the following unique arguments in your X-SMTPAPI header for an email sent using the v2 Mail Send endpoint:

Example of unique arguments in the v2 Mail Send API call

example-of-unique-arguments-in-the-v2-mail-send-api-call page anchor
1
{
2
"unique_args": {
3
"userid": "1123",
4
"template": "welcome"
5
}
6
}

You receive the same unique argument included with the data posted to your Event Webhook.

Example of unique arguments returned in Webhook

example-of-unique-arguments-returned-in-webhook page anchor
1
[
2
{
3
"sg_message_id": "sendgrid_internal_message_id",
4
"email": "alex@example.com",
5
"timestamp": 1337966815,
6
"event": "click",
7
"url": "https://example.com",
8
"userid": "1123",
9
"template": "welcome"
10
}
11
]
(warning)

Example of unique arguments using reserved keys

Though you can create unique arguments with the same words as reserved keys, Twilio SendGrid uses the reserved key value and not your unique argument value.

Reserved keys in unique arguments

reserved-keys-in-unique-arguments page anchor
1
// for this example, assume we're sending to alex@example.com
2
{
3
"unique_args": {
4
"customerAccountNumber": "55555",
5
"activationAttempt": "1",
6
"New Argument 1": "New Value 1",
7
"email": "alex@example.com",
8
"event": "SendEmail"
9
}
10
}

Events webhook call with unique arguments

events-webhook-call-with-unique-arguments page anchor
1
[
2
{
3
"event": "Processed",
4
"timestamp": "123456789",
5
"customerAccountNumber": "55555",
6
"activationAttempt": "1",
7
"New Argument 1": "New Value 1",
8
"email": "alex@example.com"
9
}
10
]

This overwrites the unique arguments, event and email, because they're reserved keys for Twilio SendGrid values.

To define and receive custom arguments when sending email with the v3 Mail Send, use the custom_args parameter. These values get added to your Event Webhook response.

Example payload for the v3 Mail Send

example-payload-for-the-v3-mail-send page anchor
1
{
2
"personalizations": [
3
{
4
"to": [
5
{
6
"email": "alex@example.com"
7
}
8
],
9
"subject": "Hello, World!",
10
"custom_args": {
11
"userid": "1123"
12
}
13
}
14
],
15
"from": {
16
"email": "from_address@example.com"
17
},
18
"content": [
19
{
20
"type": "text/plain",
21
"value": "Hello, World!"
22
}
23
]
24
}
1
[
2
{
3
"userid": "1123"
4
}
5
]

Marketing Campaign parameters to the Event Webhook

marketing-campaign-parameters-to-the-event-webhook page anchor

For emails sent through Marketing Campaigns, add Marketing Campaigns specific parameters to the Event Webhook.

Single Send custom parameters

single-send-custom-parameters page anchor

Single Send can include singlesend_id and singlesend_name. These parameters accept any string value you want to identify this message.

Example of Marketing Campaigns single send event

example-of-marketing-campaigns-single-send-event page anchor
1
[
2
{
3
"category": [],
4
"email": "alex@example.com",
5
"event": "open",
6
"ip": "127.0.0.1",
7
"mc_stats": "singlesend",
8
"phase_id": "send",
9
"send_at": "1591726752372",
10
"sg_content_type": "html",
11
"sg_event_id": "sendgrid_internal_event_id",
12
"sg_message_id": "sendgrid_internal_message_id",
13
"sg_template_id": "sendgrid_template_id",
14
"sg_template_name": "sendgrid_template_name",
15
"singlesend_id": "sendgrid_singlesend_id",
16
"singlesend_name": "Example Single Send",
17
"template_hash": "sendgrid_template_hash",
18
"template_id": "sendgrid_template_id",
19
"template_version_id": "sendgrid_template_version_id",
20
"timestamp": 1591726752372,
21
"useragent": "Mozilla/4.0 (compatible; MSIE 6.1; Windows XP; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
22
}
23
]

Standard Marketing Campaign send custom properties

standard-marketing-campaign-send-custom-properties page anchor

A Marketing Campaign send can include marketing_campaign_id and marketing_campaign_name. These parameters accept any string value you want to identify this campaign.

Example event from a standard (non-A/B test) campaign send

example-event-from-a-standard-non-ab-test-campaign-send page anchor
1
{
2
"category": [],
3
"email": "alex@example.com",
4
"event": "processed",
5
"marketing_campaign_id": 12345,
6
"marketing_campaign_name": "campaign name",
7
"post_type": "event",
8
"sg_event_id": "sendgrid_internal_event_id",
9
"sg_message_id": "sendgrid_internal_message_id",
10
"sg_user_id": 12345,
11
"smtp-id": "",
12
"timestamp": 1442349428
13
}

A/B test custom property

ab-test-custom-property page anchor

If you use an A/B test, you can use the marketing_campaign_version parameter. Its value returns a capital Latin character, starting with A, B, C, and so on.

Example event from an A/B Test

example-event-from-an-ab-test page anchor
1
{
2
"category": [],
3
"email": "tadpole_0010@stbase-018.sjc1.sendgrid.net",
4
"event": "processed",
5
"marketing_campaign_id": 23314,
6
"marketing_campaign_name": "unique args ab",
7
"marketing_campaign_version": "B",
8
"marketing_campaign_split_id": 13471,
9
"post_type": "event",
10
"sg_event_id": "qNOzbkTuTNCdxa1eXEpnXg",
11
"sg_message_id": "5lFl7Fr1Rjme_EyzNNB_5A.stfilter-015.5185.55F883172.0",
12
"sg_user_id": 939115,
13
"smtp-id": "<5lFl7Fr1Rjme_EyzNNB_5A@stismtpd-006.sjc1.sendgrid.net>",
14
"timestamp": 1442349848
15
}

Example event response from the winning phase of an A/B Test

example-event-response-from-the-winning-phase-of-an-ab-test page anchor
1
{
2
"category": [],
3
"email": "tadpole_0001@stbase-018.sjc1.sendgrid.net",
4
"event": "delivered",
5
"marketing_campaign_id": 23314,
6
"marketing_campaign_name": "unique args ab",
7
"post_type": "event",
8
"response": "250 Ok",
9
"sg_event_id": "X2M1IUfMRhuAhWM0CbmFqQ",
10
"sg_message_id": "fPJrJPIRTxC_obpgfTy74w.stfilter-015.5185.55F883564.0",
11
"sg_user_id": 12345,
12
"smtp-id": "",
13
"timestamp": 1442349911
14
}

Legacy Marketing email unsubscribes

legacy-marketing-email-unsubscribes page anchor

For emails sent through the Twilio Legacy Marketing Email tool, unsubscribe webhook resembles the following example:

Example of Legacy Marketing unsubscribe

example-of-legacy-marketing-unsubscribe page anchor
1
[
2
{
3
"email": "nick@sendgrid.com",
4
"timestamp": 1380822437,
5
"newsletter": {
6
"newsletter_user_list_id": "10557865",
7
"newsletter_id": "1943530",
8
"newsletter_send_id": "2308608"
9
},
10
"category": ["Tests", "Newsletter"],
11
"event": "unsubscribe"
12
}
13
]