# Loops

> Automate Loops: create, find, update, and delete contacts, and trigger lifecycle automations with events.

App · Email Marketing · 5 actions. Web page: https://docs.lodol.com/docs/integrations/loops

## Actions

### Create contact

Add a new contact to your Loops audience, with optional properties and mailing-list subscriptions.

**Inputs**

- Email (`email`, text, required): The contact's email address (Loops' unique identifier for a contact).
- First name (`first_name`, text): The contact's first name.
- Last name (`last_name`, text): The contact's last name.
- User ID (`user_id`, text): Your app's own unique identifier for this user. Lets you find and update the contact later by user id.
- User group (`user_group`, text): A group to segment the contact into, e.g. 'Founders' or 'Trial'. Used to target automations and lists.
- Subscribed (`subscribed`, true/false): Whether the contact is subscribed to marketing email. New contacts default to subscribed in Loops.
- Mailing lists (`mailing_lists`, object): Mailing lists to subscribe or unsubscribe the contact from, as a map of mailing-list id to true/false, e.g. {"cmXXXXt0": true}. Find list ids in Loops under Settings > Mailing lists (or via the API).
- Properties (`properties`, object): Any custom contact properties to set, as an object, e.g. {"plan": "pro", "signupSource": "web"}. Loops creates a custom property automatically the first time it sees one.

**Outputs**

- `id` (text)
- `success` (true/false)

**Example output**

```json
{
  "id": "clkq1w2xy0000ju0f3z9abcde",
  "success": true
}
```

### Delete contact

Remove a contact from your Loops audience by email, for offboarding or a data-deletion request.

**Inputs**

- Email (`email`, text, required): The email address of the contact to delete.

**Outputs**

- `success` (true/false)

**Example output**

```json
{
  "success": true
}
```

### Find contact

Look up a contact by email and return their properties and mailing-list subscriptions.

**Inputs**

- Email (`email`, text, required): The email address of the contact to find.

**Outputs**

- `contacts` (list)

**Example output**

```json
{
  "contacts": [
    {
      "email": "contact@example.com",
      "firstName": "Ada",
      "id": "clkq1w2xy0000ju0f3z9abcde",
      "lastName": "Lovelace",
      "mailingLists": {},
      "source": "API",
      "subscribed": true,
      "userGroup": "Founders",
      "userId": "user_123"
    }
  ]
}
```

### Send event

Send a lifecycle event for a contact to trigger a Loops automation (a 'loop'). Creates the contact if it doesn't exist.

**Inputs**

- Email (`email`, text, required): The email address of the contact the event is for.
- Event name (`event_name`, text, required): The name of the event, e.g. 'signup' or 'trialStarted'. This is what your Loops automations listen for.
- Event properties (`event_properties`, object): Optional data to attach to the event, as an object, e.g. {"plan": "pro"}. Available in the automation and email templates.
- Contact properties (`contact_properties`, object): Optional contact properties to set on the contact at the same time, as an object.
- Mailing lists (`mailing_lists`, object): Optional mailing lists to subscribe or unsubscribe the contact from, as a map of mailing-list id to true/false.

**Outputs**

- `success` (true/false)

**Example output**

```json
{
  "success": true
}
```

### Update contact

Update a contact's properties or mailing-list subscriptions by email. Creates the contact if it doesn't exist yet.

**Inputs**

- Email (`email`, text, required): The contact's email address (Loops' unique identifier for a contact).
- First name (`first_name`, text): The contact's first name.
- Last name (`last_name`, text): The contact's last name.
- User ID (`user_id`, text): Your app's own unique identifier for this user. Lets you find and update the contact later by user id.
- User group (`user_group`, text): A group to segment the contact into, e.g. 'Founders' or 'Trial'. Used to target automations and lists.
- Subscribed (`subscribed`, true/false): Whether the contact is subscribed to marketing email. New contacts default to subscribed in Loops.
- Mailing lists (`mailing_lists`, object): Mailing lists to subscribe or unsubscribe the contact from, as a map of mailing-list id to true/false, e.g. {"cmXXXXt0": true}. Find list ids in Loops under Settings > Mailing lists (or via the API).
- Properties (`properties`, object): Any custom contact properties to set, as an object, e.g. {"plan": "pro", "signupSource": "web"}. Loops creates a custom property automatically the first time it sees one.

**Outputs**

- `id` (text)
- `success` (true/false)

**Example output**

```json
{
  "id": "clkq1w2xy0000ju0f3z9abcde",
  "success": true
}
```
