Skip to contentSkip to navigationSkip to topbar
On this page
Looking for more inspiration?Visit the
(information)
You're in the right place! Segment documentation is now part of Twilio Docs. The content you are used to is still here—just in a new home with a refreshed look.

SendGrid Destination


SendGrid(link takes you to an external page) provides email marketing automation for businesses. With Segment you can add contacts and lists to SendGrid.


Getting started

getting-started page anchor
  1. From the Segment web app, click Catalog, then click Destinations.
  2. Find the Destinations Actions item in the left navigation, and click it.
  3. Click Configure SendGrid.
  4. Select an existing Source to connect to SendGrid.
  5. In the destination settings, enter your SendGrid "API key" into the connection settings. You should create a new API key for the Segment destination. You can read more about API keys on Marketing Campaigns's docs.

Property nameTypeRequiredDescription
Regional Processing Endpointselect

Optional

The regional processing endpoint for your SendGrid account. See more details(link takes you to an external page)


API Keypassword
required

The Api key for your SendGrid account.


Build your own Mappings. Combine supported triggers with the following SendGrid-supported actions:

(information)

Mapping limits per destination

Individual destination instances have support a maximum of 50 mappings.

Upsert Contact

upsert-contact page anchor

Add or update a Contact in SendGrid.

Upsert Contact is a Cloud action.

Property nameTypeRequiredDescription
Batch Data to SendGrid Contacts PUT APIBOOLEAN

Optional

When enabled, the action will use the SendGrid Contacts PUT API to perform the batch operation. Batches can contain up to 30k records in a request.


First NameSTRING

Optional

The contact's first name.


Last NameSTRING

Optional

The contact's last name.


CountrySTRING

Optional

The contact's country.


Postal CodeSTRING

Optional

The contact's postal code.


CitySTRING

Optional

The contact's city.


StateSTRING

Optional

The contact's state.


Address Line 1STRING

Optional

The contact's address line 1.


Address Line 2STRING

Optional

The contact's address line 2.


Phone NumberSTRING

Optional

The contact's phone number. Note: This is different from the Phone Number ID field, but the same value can be stored in both fields.


WhatsAppSTRING

Optional

The contact's WhatsApp.


LineSTRING

Optional

The contact's landline.


FacebookSTRING

Optional

The contact's Facebook identifier.


Unique NameSTRING

Optional

The contact's unique name.


Email AddressSTRING

Optional

The contact's email address.


Phone Number IDSTRING

Optional

Primary Phone Number used to identify a Contact. This must be a valid phone number.


External IDSTRING

Optional

The contact's External ID.


Anonymous ID STRING

Optional

The contact's Anonymous ID.


Other FieldsOBJECT

Optional

Additional fields to send to SendGrid. On the left-hand side, input the SendGrid Custom Fields Id. On the right-hand side, map the Segment field that contains the value.

Custom Fields must be predefined in your SendGrid account and you can retrieve corresponding Id using get all field definitions endpoint.

Reference: Get All field definitions(link takes you to an external page)

Send Email with Dynamic Template

send-email-with-dynamic-template page anchor

Send email to recipient(s) using a Dynamic Template in Sendgrid

Send Email with Dynamic Template is a Cloud action.

Property nameTypeRequiredDescription
Validated DomainSTRING

Optional

The domain to use for the email. This field is optional but recommended. If you do not provide a domain, Sendgrid will attempt to send the email based on the from address, and may fail if the domain in the from address is not validated.


FromOBJECT
required

From details.


ToOBJECT
required

Recipient details.


CCOBJECT

Optional

CC recipient details


BCCOBJECT

Optional

BCC recipient details


HeadersOBJECT

Optional

Headers for the email.


Dynamic Template DataOBJECT

Optional

A collection of property names that will be substituted by their corresponding property values in the subject, reply-to and content portions of a SendGrid Dynamic Template.


Dynamic TemplateSTRING
required

The Dynamic Template to use for the email.


Custom ArgsOBJECT

Optional

Custom arguments for the email.


Send AtSTRING

Optional

The time to send the email. ISO 8601 format. E.g. 2024-09-23T12:00:00Z. A send cannot be scheduled more than 72 hours in advance.


Reply ToOBJECT

Optional

Reply to details. If left empty 'Reply To' settings will be taken from the 'From' field values.


CategoriesSTRING

Optional

Categories for the email. Accepts a single string or array of strings.


IP PoolSTRING

Optional

Send email with an ip pool.


Group IDSTRING

Optional

Specify a Group ID


Additional details for the Send Email With Dynamic Template Action

additional-details-for-the-send-email-with-dynamic-template-action page anchor

The Send Email With Dynamic Template Action can be used to send emails through SendGrid using SendGrid Dynamic Templates. The Dynamic Template you use must already exist in SendGrid. Use the Action field Dynamic Template Data to populate values in the Dynamic Template.

SendGrid sends emails to the email addresses you specify, even if they are not listed as Contacts in SendGrid.

Segment and SendGrid recommend that you define the SendGrid API key within a subuser account and the domain is authenticated under that same subuser account. The Send Email With Dynamic Template Action requires that the SendGrid API Key has the following scopes assigned:

  • Category Management: full
  • IP Management: full
  • Template Engine: full

Additional details for the Upsert Contact Action

additional-details-for-the-upsert-contact-action page anchor

Recording Custom User Traits

recording-custom-user-traits page anchor

If you want to view any other custom user traits in the Marketing Campaigns list dashboard, you must create a Custom Field inside Marketing Campaigns's UI of the traits in your identify calls. Note that you do not need to map all user.traits you are sending inside Marketing Campaigns. You only need to create Custom Fields of the traits you want to see in your list view.

To send custom fields/user traits to Marketing Campaigns you need to create the field first in Marketing Campaigns for each trait you want sent to Marketing Campaigns. Then when you call identify with keys that match those traits they will appear in your Marketing Campaigns list.

For any other custom traits just add a Custom Field inside of SendGrid with a tag that matches the key you are using in your identify call.

To record a Segment userId in SendGrid, you must pass the userID as a trait on your identify() calls. SendGrid does not automatically map the Segment userID to any Marketing Campaigns properties.

The Upsert Contact Action requires the SendGrid API Key to have the following scopes:

  • Marketing: full