Receive Data from Segment

General Information

The Mailjet integration with Segment allows you to use the identify() call to receive data from Segment and, more specifically, from other services that you have integrated into Segment. This method allows you to essentially update your Mailjet contact list(s) with certain contacts and traits like email address, name, geography, etc., provided by other integration services that you have previously connected to your Segment account.

How to Activate Receiving Data from Segment

On the Mailjet Side:

To activate “Receive data from Segment”, select a target Contact list from the drop down menu that you wish to have Segment send contact property data into. You can also create a new contact list at this point by selecting “Create and Use a Segment Master List”. Once you have selected a list, click on the ‘Enable’ button.

segment-img16

And that’s it – the ‘receive data’ feature is now enabled and Segment will start to update your contact list so that you can become and email ninja by targeting the right people with the right message through your segmenting super powers ;).

Receiving Array Data from Segment

When sending data from Segment to Mailjet, in order to successfully save your contacts’ properties, you can do it either by listing the details one by one, or by sending them combined in an array of data.

Here is an example of a data payload containing traits with an array:

    "traits": {
        "location": {
            "latitude": 48.87347532650291,
            "longitude": 2.371577412596885
        }
    }

Mailjet will then break apart the location array into two properties (for location_latitude and location_longitude), then store the contact properties for the respective contact.

Receiving Data from Segment in Nested Arrays

However, if the information is sent from Segment in the form of a nested array (array with another array contained in it), Mailjet will not be able to properly parse the information. The contact will be successfully created in the contact list, but the nested array data will be ignored.

As an example, look at the below information sent from Segment to Mailjet:

    "traits": {
        "first_name": Sherlock,
        "last_name": Holmes,
        "location": {
            "latitude": 51.523760,
            "longitude": -0.158459
        },        
        "address": {
            "city": London,
            "street": {
                "name": Baker Street,
                "number": 221B
            }
        }
    }

The traits sent to Mailjet will be handled as follows:

  • first_name and last_name will be accepted and saved, as they are simple details.
  • The information contained within location will be split into location_latitude and location_longitude and stored, respectively, as this is a simple array, which can be decomposed by Mailjet into separate properties.
  • The information contained within address - city, street name and street number - will not be saved, as it is contained in a nested array and cannot be properly decomposed.