Documentation / Product / Integrations / SendGrid

SendGrid: Export Audiences

Exporting a Lytics audience to SendGrid allows you to send a Single Send email to your users based on your own, relevant targeting criteria, such as: cross-channel behavior, content affinities, and more.

Integration Details

  • Implementation Type: Server-side.
  • Implementation Technique: REST API with audience triggers.
  • Frequency: Real-time, with a one-time backfill of the audience after setup.
  • Resulting data: Lytics users that are a member of the selected audience(s) are exported as SendGrid contacts. A new SendGrid segment is created for each corresponding Lytics audience on the "All Contacts" list, or the list selected during configuration.

This integration utilizes the SendGrid APIs to send user data. Once the export is started the job will:

  1. Create a new custom field in SendGrid called lytics_segments to record Lytics audience membership.
  2. Create new SendGrid segment(s) on the list selected or on the "All Contacts" list if no list was selected in configuration.

The SendGrid segment(s) created by the job will ultimately contain the users from the exported Lytics audience(s). For example, if a Lytics audience named "High Value Users" with the id 5cecf2aa79b0a5641920e0607b95c793 is exported to SendGrid, you will see a new segment in SendGrid named "High Value Users". The definition of this segment will be lytics_segments contains 5cecf2aa79b0a5641920e0607b95c793.

SendGrid Segment

After a backfill, the job will receive real-time updates when a user enters or exits the audience. For each user to export, regardless if the user is being added as part of the backfill, or they're entering/exiting the audience in realtime, it will:

  1. Create the users as contacts in SendGrid.
  2. If a list was selected in configuration the users will be added to the list as part of the update.

The lytics_segments field is automatically populated with the a comma separated list of Lytics audience IDs the user is currently a member of. That is, once a user leaves the audience in Lytics, this field will be updated in SendGrid, and they will be removed from the SendGrid segment. Users will not automatically be removed from your SendGrid account, or the list your segment is on.

Fields

By default, Lytics exports the following fields to SendGrid. You can export any Lytics user field to a custom SendGrid field, so long as the field type is a string, int or date. You can customize the Lytics source fields as part of the job configuration.

Lytics User FieldDescriptionSendGrid FieldType
last_nameLast Namelast_namestring
first_nameFirst Namefirst_namestring
emailEmailemailstring
lytics_segmentsstring

Note: additional lytics_segments fields (with an integer suffix e.g. lytics_segments_1) may be created if the total number of segments exported exceeds the max field size.

Configuration

Follow these steps to set up and configure an export of users to SendGrid in the Lytics platform. If you are new to creating jobs in Lytics, see the Jobs Dashboard documentation for more information.

  1. Select SendGrid from the list of providers.
  2. Select the Export Audiences job type from the list.
  3. Select the Authorization you would like to use or create a new one.
  4. Enter a Label to identify this job you are creating in Lytics.
  5. (Optional) Enter a Description for further context on your job.
  6. Using the Audiences input, you may select Lytics audiences to export to SendGrid. Audiences in the right column will be exported.
  7. To use a non-default user field for email, select a field from the Email Field dropdown.
  8. (Optional) Toggle Show Advanced Options to reveal the following options.
  9. (Optional) Select a field from the First Name Field dropdown to use a non-default user field for first name.
  10. (Optional) Select a field from the Last Name Field dropdown to use a non-default user field for last name.
  11. (Optional) Select a list from the Export to List dropdown if you would like to export your users to segment(s) on a list within SendGrid.
  12. (Optional) Using the Custom Field Mappings you can map additional Lytics User fields to custom fields in SendGrid
  13. Click Start Export. SendGrid Export