> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# Create Contact

- Component: `appmixer.loops.core.CreateContact`
- Kind: Action
- Version: 1.0.0
- Visibility: Public
- Connector: [appmixer.loops 1.0.0](https://connectors.appmixer.com/connector/appmixer.loops/1.0.0.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.loops/1.0.0/component/appmixer.loops.core.CreateContact>

Add a contact to your Loops audience. Fails when a contact with the same email or user ID already exists; use Update Contact to update or create.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Email (`email`) | text | The contact's email address. |
| First Name (`firstName`) | text | The contact's first name. |
| Last Name (`lastName`) | text | The contact's last name. |
| User ID (`userId`) | text | A unique user ID, for example the ID of the user in your application. |
| User Group (`userGroup`) | text | The contact's user group, for example `customers`. |
| Source (`source`) | text | A custom source value to replace the default "API". |
| Subscribed (`subscribed`) | toggle | Whether the contact will receive campaign and workflow emails. New contacts are subscribed by default. |
| Mailing Lists (`mailingLists`) | multiselect | Mailing lists to add the contact to. Pick lists, or map a comma-separated list of mailing list IDs. |
| Custom Properties (`customProperties`) | textarea | Optional JSON object of custom contact properties, for example `{"planName": "Pro", "seats": 5}`. Values can be strings, numbers, booleans or dates. Create the properties in Loops first (see Create Contact Property). |

## Output ports

### Port `out`

| Field | Type | Description |
| --- | --- | --- |
| Contact ID (`id`) | string | - |
| Email (`email`) | string | - |

## Full metadata (component.json)

```json
{
  "name": "appmixer.loops.core.CreateContact",
  "label": "Create Contact",
  "description": "Add a contact to your Loops audience. Fails when a contact with the same email or user ID already exists; use Update Contact to update or create.",
  "author": "Appmixer <info@appmixer.com>",
  "version": "1.0.0",
  "auth": {
    "service": "appmixer:loops"
  },
  "quota": {
    "manager": "appmixer:loops",
    "resources": "requests",
    "scope": {
      "userId": "{{userId}}"
    }
  },
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "userId": {
            "type": "string"
          },
          "userGroup": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "subscribed": {
            "type": "boolean"
          },
          "mailingLists": {
            "type": [
              "array",
              "string"
            ]
          },
          "customProperties": {
            "type": "string"
          }
        },
        "required": [
          "email"
        ]
      },
      "inspector": {
        "inputs": {
          "email": {
            "type": "text",
            "index": 1,
            "label": "Email",
            "tooltip": "The contact's email address."
          },
          "firstName": {
            "type": "text",
            "index": 2,
            "label": "First Name",
            "tooltip": "The contact's first name."
          },
          "lastName": {
            "type": "text",
            "index": 3,
            "label": "Last Name",
            "tooltip": "The contact's last name."
          },
          "userId": {
            "type": "text",
            "index": 4,
            "label": "User ID",
            "tooltip": "A unique user ID, for example the ID of the user in your application."
          },
          "userGroup": {
            "type": "text",
            "index": 5,
            "label": "User Group",
            "tooltip": "The contact's user group, for example <code>customers</code>."
          },
          "source": {
            "type": "text",
            "index": 6,
            "label": "Source",
            "tooltip": "A custom source value to replace the default \"API\"."
          },
          "subscribed": {
            "type": "toggle",
            "index": 7,
            "label": "Subscribed",
            "defaultValue": true,
            "tooltip": "Whether the contact will receive campaign and workflow emails. New contacts are subscribed by default."
          },
          "mailingLists": {
            "type": "multiselect",
            "index": 8,
            "label": "Mailing Lists",
            "tooltip": "Mailing lists to add the contact to. Pick lists, or map a comma-separated list of mailing list IDs.",
            "source": {
              "url": "/component/appmixer/loops/core/ListMailingLists?outPort=out",
              "data": {
                "messages": {
                  "in/outputType": "array"
                },
                "properties": {
                  "isSource": true
                },
                "transform": "./ListMailingLists#toSelectArray"
              }
            }
          },
          "customProperties": {
            "type": "textarea",
            "index": 9,
            "label": "Custom Properties",
            "tooltip": "Optional JSON object of custom contact properties, for example <code>{\"planName\": \"Pro\", \"seats\": 5}</code>. Values can be strings, numbers, booleans or dates. Create the properties in Loops first (see Create Contact Property)."
          }
        }
      }
    }
  ],
  "outPorts": [
    {
      "name": "out",
      "schema": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "title": "Contact ID",
            "example": "clh3k9m2p4q6r8s0t2v4x6z8"
          },
          "email": {
            "type": "string",
            "title": "Email",
            "example": "alex@company.com"
          }
        }
      }
    }
  ],
  "icon": "(data URI omitted)"
}
```
