# Cordial

> Manage Cordial contacts, lists, orders and products, record events, send automation templates, start orchestrations, and follow opens, clicks, unsubscribes and orders.

App · 25 actions. Web page: https://docs.lodol.com/docs/integrations/cordial

## Actions

### Create contact

Create a contact with their email address, subscription status, lists and attributes.

**Inputs**

- Email (`email`, text, required): The contact's email address.
- Email subscription (`subscribe_status`, text): Whether the contact gets promotional email. Leave empty for not subscribed yet. One of: `subscribed`, `unsubscribed`, `none` (Not subscribed yet).
- Add to lists (`lists`, list): Lists to add the contact to.
- Attributes (`attributes`, object): Contact attribute values to save, each an attribute key with its value, such as `first_name`: `Jane`. The attributes must already exist in Cordial.
- Suppress triggered messages (`suppress_triggers`, true/false): Off to let messages that fire on attribute changes send for this contact. Cordial suppresses them unless told otherwise.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "cID": "example",
    "message": "example",
    "success": true
  }
}
```

### Create contact event

Record a custom event, such as a browse or a sign-up, on a contact. Events can start orchestrations and build audiences.

**Inputs**

- Email (`email`, text, required): The contact's email address.
- Event name (`event_name`, text, required): The event's name, up to 40 characters, such as `browse`.
- When (`time`, date and time): When it happened. Leave empty for now.
- Properties (`properties`, object): Details of the event, each a name with its value, such as `product_id`: `p_8421`.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```

### Create list

Create a contact list.

**Inputs**

- Name (`name`, text, required): The list's name, unique in the account.
- Track join dates (`track_dates`, true/false): On to record the date each contact joins the list.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```

### Create or update product

Add a product to the catalog, or replace it if a product with the same ID exists.

**Inputs**

- Product ID (`product_id`, text, required): The product's ID.
- Name (`name`, text, required): The product's name.
- Description (`description`, text): The product's description.
- Price (`price`, number): The product's price. At least 0.
- Category (`category`, text): The product's category.
- Page URL (`url`, text): The product page's address.
- Image URLs (`images`, list): Image addresses.
- Tags (`tags`, list): Words that describe the product.
- In stock (`in_stock`, true/false): On when it's in stock.
- Enabled (`enabled`, true/false): On to show it in messages.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```

### Create order

Record a contact's order with its items, for revenue reporting and order-based messages.

**Inputs**

- Order ID (`order_id`, text, required): Your order ID, unique in the account.
- Contact ID (`contact_id`, text, required): The buyer's Cordial contact ID (cID), which Create contact returns.
- Purchase date (`purchase_date`, date and time, required): When the order was placed.
- Items (`items`, list, required): The items bought.
- Status (`status`, text): The order's status, such as `placed`.
- Store ID (`store_id`, text): The store it was placed in.
- Customer ID (`customer_id`, text): The buyer's ID in your store.
- Tax (`tax`, number): The tax charged. At least 0.
- Shipping (`shipping`, number): The shipping and handling charged. At least 0.
- Properties (`properties`, object): Other details, each a name with its value.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```

### Delete contact

Delete a contact and their attribute values. This can't be undone.

**Inputs**

- Contact (`contact`, text, required): The contact's email address, or their Cordial contact ID (cID) written as `cID:` followed by the ID.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```

### Delete list

Delete a list. Its contacts stay in the account.

**Inputs**

- List (`list_id`, number, required): The list. At least 1.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```

### Delete order

Delete an order. This can't be undone.

**Inputs**

- Order ID (`order_id`, text, required): The order's ID.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```

### Delete product

Delete a product from the catalog.

**Inputs**

- Product (`product_id`, text, required): The product.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```

### Get contact

Get a contact with their channels, subscription status, lists and attributes.

**Inputs**

- Contact (`contact`, text, required): The contact's email address, or their Cordial contact ID (cID) written as `cID:` followed by the ID.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "_id": "example",
    "attributes": {},
    "channels": {
      "email": {
        "address": "example",
        "subscribeStatus": "example"
      }
    },
    "lastModified": "example",
    "lists": [
      "example"
    ]
  }
}
```

### Get list size

Get a list with the number of contacts on it.

**Inputs**

- List (`list_id`, number, required): The list. At least 1.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "count": 1,
    "id": 1,
    "name": "example"
  }
}
```

### Get order

Get an order with its items.

**Inputs**

- Order ID (`order_id`, text, required): The order's ID.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "cID": "example",
    "customerID": "example",
    "email": "example",
    "items": [
      {
        "category": "example",
        "itemPrice": 1,
        "name": "example",
        "productID": "example",
        "qty": 1,
        "sku": "example"
      }
    ],
    "orderID": "example",
    "properties": {},
    "purchaseDate": "example",
    "shippingAndHandling": 1,
    "status": "example",
    "storeID": "example",
    "tax": 1
  }
}
```

### Get product

Get a product from the catalog.

**Inputs**

- Product (`product_id`, text, required): The product.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "category": "example",
    "description": "example",
    "enabled": true,
    "images": [
      "example"
    ],
    "inStock": true,
    "price": 1,
    "productID": "example",
    "productName": "example",
    "tags": [
      "example"
    ],
    "url": "example"
  }
}
```

### List automation templates

List the automation templates, the saved messages that can be sent to one contact at a time.

**Inputs**

- Tags (`tags`, list): Only templates with these message tags.
- Page (`page`, number): The page to return, starting at 1. Leave empty for the first. At least 1.
- Records per page (`per_page`, number): How many records a page holds. Leave empty for Cordial's default. From 1 to 1000.

**Outputs**

- `data` (list): The response from Cordial.

**Example output**

```json
{
  "data": [
    {
      "channel": "example",
      "classification": "example",
      "ct": "example",
      "key": "example",
      "lm": "example",
      "name": "example",
      "tags": [
        "example"
      ]
    }
  ]
}
```

### List batch messages

List batch messages (one-off sends to an audience), optionally by status or send time.

**Inputs**

- Status (`status`, text): Only messages with this status. One of: `sent`, `pending` (Scheduled), `processing` (Sending), `paused`, `canceled`.
- Sent from (`since`, date and time): Only messages sent at or after this time.
- Page (`page`, number): The page to return, starting at 1. Leave empty for the first. At least 1.
- Records per page (`per_page`, number): How many records a page holds. Leave empty for Cordial's default. From 1 to 1000.

**Outputs**

- `data` (list): The response from Cordial.

**Example output**

```json
{
  "data": [
    {
      "_id": "example",
      "bmID": "example",
      "channel": "example",
      "ct": "example",
      "name": "example",
      "sendTime": "example",
      "status": "example",
      "tags": [
        "example"
      ]
    }
  ]
}
```

### List contact events

List contact events, newest first, such as opens, clicks and your own custom events, optionally for one contact, event name or time range.

**Inputs**

- Event name (`event_name`, text): Only events with this name, such as `open`, `click`, `message-sent`, `optout` or your own.
- Email (`email`, text): Only this contact's events.
- From (`since`, date and time): Only events at or after this time.
- To (`before`, date and time): Only events before this time.
- Records per page (`per_page`, number): How many events to return. Leave empty for Cordial's default. From 1 to 1000.

**Outputs**

- `data` (list): The response from Cordial.

**Example output**

```json
{
  "data": [
    {
      "_id": "example",
      "a": "example",
      "action": "example",
      "ats": "example",
      "bmID": "example",
      "cID": "example",
      "email": "example",
      "mcID": "example",
      "properties": {},
      "time": "example"
    }
  ]
}
```

### List contacts

List contacts, or only those in a saved audience, with their channels and attributes.

**Inputs**

- Email (`email`, text): Only the contact with this email address.
- Saved audience key (`audience_key`, text): Only contacts in this saved audience rule, by its key.
- Page (`page`, number): The page to return, starting at 1. Leave empty for the first. At least 1.
- Records per page (`per_page`, number): How many records a page holds. Leave empty for Cordial's default. From 1 to 1000.

**Outputs**

- `data` (list): The response from Cordial.

**Example output**

```json
{
  "data": [
    {
      "_id": "example",
      "attributes": {},
      "channels": {
        "email": {
          "address": "example",
          "subscribeStatus": "example"
        }
      },
      "lastModified": "example",
      "lists": [
        "example"
      ]
    }
  ]
}
```

### List lists

List the account's contact lists.

**Inputs**

- Name (`name`, text): Only the list with this name.

**Outputs**

- `data` (list): The response from Cordial.

**Example output**

```json
{
  "data": [
    {
      "enhanced": true,
      "id": 1,
      "name": "example"
    }
  ]
}
```

### List orders

List orders, optionally for one contact or purchased in a time range.

**Inputs**

- Email (`email`, text): Only this contact's orders.
- Contact ID (`contact_id`, text): Only orders of the contact with this cID.
- From (`since`, date and time): Only orders bought at or after this time.
- To (`before`, date and time): Only orders bought before this time.
- Order (`sort_dir`, text): Newest or oldest first. One of: `desc` (Newest first), `asc` (Oldest first).
- Page (`page`, number): The page to return, starting at 1. Leave empty for the first. At least 1.
- Records per page (`per_page`, number): How many records a page holds. Leave empty for Cordial's default. From 1 to 1000.

**Outputs**

- `data` (list): The response from Cordial.

**Example output**

```json
{
  "data": [
    {
      "cID": "example",
      "customerID": "example",
      "email": "example",
      "items": [
        {
          "category": "example",
          "itemPrice": 1,
          "name": "example",
          "productID": "example",
          "qty": 1,
          "sku": "example"
        }
      ],
      "orderID": "example",
      "properties": {},
      "purchaseDate": "example",
      "shippingAndHandling": 1,
      "status": "example",
      "storeID": "example",
      "tax": 1
    }
  ]
}
```

### List products

List the products in Cordial's catalog.

**Inputs**

- Page (`page`, number): The page to return, starting at 1. Leave empty for the first. At least 1.
- Records per page (`per_page`, number): How many records a page holds. Leave empty for Cordial's default. From 1 to 1000.

**Outputs**

- `data` (list): The response from Cordial.

**Example output**

```json
{
  "data": [
    {
      "category": "example",
      "description": "example",
      "enabled": true,
      "images": [
        "example"
      ],
      "inStock": true,
      "price": 1,
      "productID": "example",
      "productName": "example",
      "tags": [
        "example"
      ],
      "url": "example"
    }
  ]
}
```

### Send automation template

Send an automation template's published message to a contact, with values for its variables. Creates the contact if they're new.

**Inputs**

- Template (`template_key`, text, required): The automation template to send.
- Email (`email`, text, required): The recipient's email address.
- Variables (`variables`, object): Values the message uses, each a name with its value, such as `orderID`: `o1234` (shown in the message as `{$extVars.orderID}`).

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```

### Trigger orchestration

Start an orchestration (a multi-step journey) for a contact, with values for its variables. Creates the contact if they're new.

**Inputs**

- Orchestration (`orchestration_id`, text, required): The orchestration to start.
- Email (`email`, text, required): The contact's email address.
- Variables (`variables`, object): Values the orchestration's messages use, each a name with its value.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```

### Unsubscribe contact

Unsubscribe a contact from a channel, so they get no promotional messages on it.

**Inputs**

- Contact (`contact`, text, required): The contact's email address, or their Cordial contact ID (cID) written as `cID:` followed by the ID.
- Channel (`channel`, text): The channel to unsubscribe the contact from. One of: `email`, `sms`, `push` (Push notifications). Default: `email`.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```

### Update contact

Change a contact's email address, subscription, lists or attributes. Fields left empty stay as they are.

**Inputs**

- Contact (`contact`, text, required): The contact's email address, or their Cordial contact ID (cID) written as `cID:` followed by the ID.
- New email (`new_email`, text): The contact's new email address.
- Email subscription (`subscribe_status`, text): The contact's new email subscription. One of: `subscribed`, `unsubscribed`, `none` (Not subscribed yet).
- Resubscribe if unsubscribed (`force_subscribe`, true/false): On to subscribe a contact who had unsubscribed. Only do this with their consent.
- Add to lists (`lists`, list): Lists to add the contact to.
- Remove from lists (`remove_lists`, list): Lists to take the contact off.
- Attributes (`attributes`, object): Contact attribute values to save, each an attribute key with its value, such as `first_name`: `Jane`. The attributes must already exist in Cordial.
- Suppress triggered messages (`suppress_triggers`, true/false): Off to let messages that fire on attribute changes send.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```

### Update list

Rename a list or turn its join-date tracking on or off.

**Inputs**

- List (`list_id`, number, required): The list. At least 1.
- Name (`name`, text): The list's new name.
- Track join dates (`track_dates`, true/false): On to record the date each contact joins the list.

**Outputs**

- `data` (object): The response from Cordial.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```
