Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Personalize and segment messages with custom fields


(information)

Covers Marketing Campaigns v3

These tutorials cover the latest version of Marketing Campaigns. If you're using the legacy version of Marketing Campaigns, your experience might differ.

To add extra information about a contact, create custom fields. Common use cases for custom fields include:

  • Creating dynamic segments.
  • Personalizing the subject lines or content of Marketing Campaign email messages you send.

You can create up to 500 custom fields using the labels and values of your choice.


Custom field rules

custom-field-rules page anchor

Custom fields must meet the following requirements:

Field names

field-names page anchor

The field name must:

  • Include alphanumeric characters (A-Z and 0-9) and underscores (_).
  • Begin with letters A-Z or underscores (_).

You can create three different types of custom fields according to their data type. The data type impacts the queries used for segmentation:

TypeQuery methodExample
DateFind contacts before, after, or on a specific date.1/1/2014
TextFind contacts who match the specific text.A pet field that says Dog
NumberFind decimal or integer values greater than, less than, or equal to a specific number.Contact age: 27
(warning)

Warning

Twilio limits the length of text custom fields to 1,000 characters.

Your account comes preloaded with immutable reserved fields. Twilio reserves the following field names:

Field nameField type
first_nametext
last_nametext
emailtext
phone_number_idtext
external_idtext
anonymous_idtext
alternate_emailstext
address_line_1text
address_line_2text
citytext
state_province_regiontext
postal_codetext
countrytext
phone_numbertext
whatsapptext
linetext
facebooktext
unique_nametext

Twilio deprecated the following contact custom fields:

  • whatsapp
  • line
  • facebook
  • unique_name

Twilio SendGrid populates six reserved fields:

  • lists
  • created_at
  • updated_at
  • last_emailed
  • last_clicked
  • last_opened

Reserved fields track useful metrics for your contacts.


To add a custom field, add the field using one of the following methods:

Upload CSVAPIConsole

To add multiple contacts at a time, upload a comma-separated value (CSV) file. These CSV files can contain a maximum of one million contacts or 5 GB in file size, whichever is less.

  1. Download this CSV template. It ensures the correct format for your import.
  2. Log in to the Twilio SendGrid console if needed.
  3. Go to Marketing > Contacts(link takes you to an external page) in the Twilio SendGrid console.
  4. From the Add Contacts menu, select Upload CSV.
  5. A page displays where you can choose where you want to add your contacts:
    • All Contacts
    • To an existing list
    • To a new list you create
  6. Upload your CSV file using one of two options:
    • Drag and drop it onto the upload box.
    • Click the select a CSV file to upload.
  7. Click Next: Review CSV Upload.
  8. Another page displays that lists all fields related to your contacts. This displays fields without a corresponding reserved or system field.
  9. With each unmapped field, choose one of three options:
    1. Select a custom field from the drop-down.
    2. Click Create New Custom Field for a new custom field.
    3. Choose Skip Column for any fields you don't want to map.
  10. When you're done mapping the fields, click Next: Add Contacts.
  11. This queues your contacts for upload. Added contacts might take some time to display depending on the number of contacts added.
  12. After Twilio processes the CSV file, it sends you a notification email.

To delete a custom field:

  1. Go to Marketing and select Custom Fields.
  2. Locate the field you wish to remove.
  3. Hover over the action menu next to the field name entry.
  4. Click the delete icon.
  5. A confirmation modal appears: Are you sure you want to delete this custom field?.
    • To delete the contact from your account, click Delete Field.
    • To keep the contact in your account, click Cancel.
  6. The panel closes and a banner displays Success! Your custom field has been deleted!

This deletion process may take several minutes. The custom field remains on this page until the process completes.

(warning)

Deleting custom fields deletes their values

When you delete a custom field, you also delete the field values for every contact. It also breaks single sends or automation emails using the custom field as a tag or segments using the field as a condition.


How custom fields impact your campaigns

how-custom-fields-impact-your-campaigns page anchor

If you delete a custom field used as criteria within a segment, the segment fails to load. You can't send email messages to a segment based on a deleted custom field.

When you delete a custom field used as a substitution tag of an email message, the fallback works in this order:

  1. Twilio SendGrid replaces it with the default value you set.
  2. Twilio SendGrid replaces it with the system default.
  3. Twilio SendGrid displays nothing in the custom field's place.

If a custom field value doesn't appear in place of the corresponding Substitution Tag, try one of these two solutions:

  1. Verify that the contact has a custom field value. In custom fields without values, Twilio uses a space.
  2. Check the spelling of the substitution tag in your message.