Our Segment integration lets you:

  • Create and update contacts
  • Send events to trigger loops

Visit our Segment integration to learn more and follow the steps below.

Configuring the destination

After opening the link above, click Configure Loops (Actions).

Adding Loops in Segment

Select your data source, give the destination a name, and click Create destination.

Next, you’ll need an API key. You can generate a new one for Segment on the Loops API Settings page.

Enter the API key on your Segment destination settings:

Add an API key

Enable the destination and click Save Changes. Note that no data will start flowing until you create specific mappings for Loops.

Mappings

Segment action destinations require that you map specific fields from your source to your destination (in this case Loops). You can set this up by clicking into the Mappings tab and adding a new mapping. Currently we support updating contacts in Loops and sending events into Loops.

Create or update contact

First, select which events to map. Typically for contact creation and updates, the most useful event to map will be “Identify”.

Map contact properties

The next step is to load a sample event to help you map fields appropriately. For this example, we’ll be using this test event:

{
	"messageId": "segment-test-message-gt3ds8",
	"timestamp": "2023-05-24T17:58:30.352Z",
	"type": "identify",
	"email": "[email protected]",
	"traits": {
		"firstName": "Adam",
		"favoriteColor": "blue",
		"favoriteNumber": 42
	},
	"userId": "test-user-a5h7xb"
}

When sending a contact’s details to Loops, you must include an Email and a User ID.

We’ve provided some defaults for the mappings, which will show up in the third step, but it is important you review them:

Default contact mappings

Segment does not provide an interface to provide the names and types for custom fields that you might be using with Loops. In this example, those fields are favoriteColor and favoriteNumber. However, these fields can be passed as a dictionary to the Custom Contact Attributes field.

Ensure that the keys and values you provide match the schema you’ve created in your Contact properties settings.

Click Edit Object to specify the custom fields you want to send to Loops individually:

Mapping custom contact properties

In most cases, you want to leave the Subscribed field as the default (deselected). Setting this to true will re-subscribe contacts who had previously unsubscribed, and setting it to false will unsubscribe contacts from email. Leaving it deselected will default new users as subscribed to email and not update the email preference for existing contacts.

Subscribed field

After the mappings are configured, send a test event from the fourth step and you should get a successful response:

Successful response

Check your Loops audience page to ensure the contact was created as intended.

Sending another test event with the same User ID or Email will update the existing contact instead of creating a new contact.

Send event

You can send events to trigger loops.

First, select which events to map. Typically for sending an event, the most useful event to map will be “Track”. It’s suggested you filter the events down to only ones that you plan on using within Loops using the Event Name filter:

Sent event in Segment

Then after defining or loading a sample event in step 2, configure the mapping. If you want to add event properties, you can pass them as a dictionary to the Event Properties field. Click Edit Object to map the properties to your event property names.

Configure event mappings

If a contact already exists in your Loops audience, the email field is optional. Loops will trigger based on the User ID. If the contact does not exist in your Loops audience (perhaps you are not using an identify call), you will need to provide an email address otherwise Loops will not be able to create the contact for the event.

After configuring the mapping, you can send a test event in the fourth step and the response should indicate success:

Success message

You can verify the event was received on your Events page in Loops.

Was this page helpful?