# Chameleon

> Send users, companies and events to Chameleon, look up and delete them, publish tours and microsurveys, show one to a user, read microsurvey responses and tour progress, manage webhooks, and follow new responses, tour completions and new companies.

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

## Actions

### Cancel delivery

Cancel a delivery that hasn't been shown yet.

**Inputs**

- Delivery ID (`delivery_id`, text, required): The delivery's ID, which Show tour or microsurvey to user returns.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "delivery": {
      "id": "example"
    }
  }
}
```

### Create or update company

Add a company, or update the one with this company ID. Only the properties sent change.

**Inputs**

- Company ID (`uid`, text, required): The company's ID in your product.
- Other properties (`properties`, object): Other properties to set, by name, such as plan or role.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "company": {
      "id": "example"
    }
  }
}
```

### Create or update user

Add a user profile, or update the one with this user ID or email address. Only the properties sent change.

**Inputs**

- User ID (`uid`, text): The user's ID in your product, the same one your app sends Chameleon. Needed to create a user.
- Email (`email`, text): The user's email address.
- Company ID (`company_uid`, text): The ID, in your product, of the company the user belongs to.
- Other properties (`properties`, object): Other properties to set, by name, such as plan or role.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "profile": {
      "id": "example"
    }
  }
}
```

### Create webhook

Send Chameleon's events, such as finished microsurveys, to a URL. An account has at most 5.

**Inputs**

- URL (`url`, text, required): Where to send the events. It must start with https://.
- Events (`topics`, list, required): The events to send. One or more of: `response.finished` (Microsurvey response finished), `tour.started`, `tour.completed`, `tour.exited`, `tour.snoozed`, `tour.button.clicked`, `survey.started`, `survey.completed`, `survey.exited`, `survey.snoozed`, and 16 more.
- Tours and microsurveys (`experience_ids`, list): Only events about these tours and microsurveys. Leave empty for all of them.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "webhook": {
      "id": "example",
      "last_item_at": "example",
      "last_item_error": "example",
      "last_item_state": "example",
      "name": "example",
      "uid": "example"
    }
  }
}
```

### Delete company

Delete a company, and take it off its users. Optionally delete its users too.

**Inputs**

- Find company by (`find_by`, text): What the company is looked up by. Leave empty for its company ID. One of: `uid` (User ID), `id` (Chameleon ID). Default: `uid`.
- Company (`company`, text, required): The company's ID from your product, or its Chameleon ID, matching Find company by.
- Delete its users too (`with_users`, true/false): Also delete every user in the company.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "deletion": {
      "id": "example"
    },
    "deletions": [
      {
        "id": "example"
      }
    ]
  }
}
```

### Delete user

Delete a user and everything Chameleon recorded about them, for good.

**Inputs**

- Find user by (`find_by`, text): What the user is looked up by. Leave empty for their user ID. One of: `uid` (User ID), `email` (Email address), `id` (Chameleon ID). Default: `uid`.
- User (`profile`, text, required): The user's ID from your product, email address or Chameleon ID, matching Find user by.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "deletion": {
      "id": "example"
    },
    "profile": {
      "id": "example"
    }
  }
}
```

### Delete webhook

Remove a webhook, so its URL gets no more events.

**Inputs**

- Webhook (`webhook_id`, text, required): The webhook.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "webhook": {
      "id": "example"
    }
  }
}
```

### Get company

Get a company with every property Chameleon holds for it.

**Inputs**

- Find company by (`find_by`, text): What the company is looked up by. Leave empty for its company ID. One of: `uid` (User ID), `id` (Chameleon ID). Default: `uid`.
- Company (`company`, text, required): The company's ID from your product, or its Chameleon ID, matching Find company by.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "company": {
      "created_at": "example",
      "id": "example",
      "uid": "example"
    }
  }
}
```

### Get microsurvey

Get a microsurvey with its publish state and statistics.

**Inputs**

- Microsurvey (`survey_id`, text, required): The microsurvey.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "survey": {
      "created_at": "example",
      "dashboard_url": "example",
      "id": "example",
      "name": "example",
      "position": 1,
      "published_at": "example",
      "scheduled_publish_at": "example",
      "scheduled_unpublish_at": "example",
      "segment_ids": [
        "example"
      ],
      "stats": {
        "completed_count": 1,
        "exited_count": 1,
        "last_completed_at": "example",
        "last_exited_at": "example",
        "last_started_at": "example",
        "started_count": 1
      },
      "tag_ids": [
        "example"
      ],
      "updated_at": "example"
    }
  }
}
```

### Get segment

Get a segment and its filters.

**Inputs**

- Segment (`segment_id`, text, required): The segment.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "segment": {
      "created_at": "example",
      "id": "example",
      "items": [
        {
          "id": "example",
          "kind": "example",
          "op": "example",
          "prop": "example",
          "value": "example"
        }
      ],
      "items_op": "example",
      "name": "example",
      "updated_at": "example"
    }
  }
}
```

### Get tour

Get a tour with its publish state and statistics.

**Inputs**

- Tour (`tour_id`, text, required): The tour.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "tour": {
      "created_at": "example",
      "dashboard_url": "example",
      "id": "example",
      "name": "example",
      "position": 1,
      "published_at": "example",
      "scheduled_publish_at": "example",
      "scheduled_unpublish_at": "example",
      "segment_ids": [
        "example"
      ],
      "stats": {
        "completed_count": 1,
        "exited_count": 1,
        "last_completed_at": "example",
        "last_exited_at": "example",
        "last_started_at": "example",
        "started_count": 1
      },
      "style": "example",
      "tag_ids": [
        "example"
      ],
      "updated_at": "example"
    }
  }
}
```

### Get user

Get a user profile with every property Chameleon holds for it.

**Inputs**

- Find user by (`find_by`, text): What the user is looked up by. Leave empty for their user ID. One of: `uid` (User ID), `email` (Email address), `id` (Chameleon ID). Default: `uid`.
- User (`profile`, text, required): The user's ID from your product, email address or Chameleon ID, matching Find user by.
- Include company (`full_profiles`, true/false): Also return every property of the user's company.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "profile": {
      "browser_k": "example",
      "browser_l": "example",
      "company_id": "example",
      "created_at": "example",
      "delivery_ids": [
        "example"
      ],
      "email": "example",
      "id": "example",
      "last_seen_at": "example",
      "last_seen_session_count": 1,
      "uid": "example",
      "updated_at": "example"
    }
  }
}
```

### List companies

List companies, newest first.

**Inputs**

- Records to return (`limit`, number): How many to return, up to 500. Leave empty for 50. From 1 to 500.
- Next page cursor (`before`, text): The cursor's before value from the last page, to read the next page.
- Created after (`created_after`, date and time): Only records created at or after this time.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "companies": [
      {
        "created_at": "example",
        "id": "example",
        "uid": "example"
      }
    ],
    "cursor": {
      "before": "example",
      "limit": 1
    }
  }
}
```

### List deliveries

List deliveries, newest first, optionally for one tour or microsurvey or one user.

**Inputs**

- Tour or microsurvey (`model_id`, text): Only deliveries of this tour or microsurvey.
- User's Chameleon ID (`profile_id`, text): Only deliveries to this user, by Chameleon ID.
- Records to return (`limit`, number): How many to return, up to 500. Leave empty for 50. From 1 to 500.
- Next page cursor (`before`, text): The cursor's before value from the last page, to read the next page.
- Created after (`created_after`, date and time): Only records created at or after this time.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "deliveries": [
      {
        "at": "example",
        "created_at": "example",
        "id": "example",
        "idempotency_key": "example",
        "interaction_id": "example",
        "model_id": "example",
        "model_kind": "example",
        "once": true,
        "options": {},
        "profile_id": "example",
        "use_segmentation": true
      }
    ]
  }
}
```

### List microsurvey responses

List a microsurvey's responses, newest first: the button clicked, any comment, and who answered.

**Inputs**

- Microsurvey (`survey_id`, text, required): The microsurvey.
- Order by (`order`, text): Sort by when each was created or last updated, newest first. Leave empty for created. One of: `created_at` (Created), `updated_at` (Last updated). Default: `created_at`.
- Full user details (`full_profiles`, true/false): Return every property of each user, not just their IDs.
- Records to return (`limit`, number): How many to return, up to 500. Leave empty for 50. From 1 to 500.
- Next page cursor (`before`, text): The cursor's before value from the last page, to read the next page.
- Created after (`created_after`, date and time): Only records created at or after this time.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "cursor": {
      "before": "example",
      "limit": 1
    },
    "responses": [
      {
        "button_order": 1,
        "button_text": "example",
        "created_at": "example",
        "dropdown_items": "example",
        "finished_at": "example",
        "href": "example",
        "id": "example",
        "input_text": "example",
        "profile": {
          "email": "example",
          "id": "example",
          "uid": "example"
        },
        "profile_id": "example",
        "survey_id": "example",
        "updated_at": "example"
      }
    ]
  }
}
```

### List microsurveys

List microsurveys with their publish state and response counts.

**Inputs**

- Records to return (`limit`, number): How many to return, up to 500. Leave empty for 50. From 1 to 500.
- Next page cursor (`before`, text): The cursor's before value from the last page, to read the next page.
- Created after (`created_after`, date and time): Only records created at or after this time.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "cursor": {
      "before": "example",
      "limit": 1
    },
    "surveys": [
      {
        "created_at": "example",
        "dashboard_url": "example",
        "id": "example",
        "name": "example",
        "position": 1,
        "published_at": "example",
        "scheduled_publish_at": "example",
        "scheduled_unpublish_at": "example",
        "segment_ids": [
          "example"
        ],
        "stats": {
          "completed_count": 1,
          "exited_count": 1,
          "last_completed_at": "example",
          "last_exited_at": "example",
          "last_started_at": "example",
          "started_count": 1
        },
        "tag_ids": [
          "example"
        ],
        "updated_at": "example"
      }
    ]
  }
}
```

### List segments

List segments, newest first.

**Inputs**

- Records to return (`limit`, number): How many to return, up to 500. Leave empty for 50. From 1 to 500.
- Next page cursor (`before`, text): The cursor's before value from the last page, to read the next page.
- Created after (`created_after`, date and time): Only records created at or after this time.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "cursor": {
      "before": "example",
      "limit": 1
    },
    "segments": [
      {
        "created_at": "example",
        "id": "example",
        "items": [
          {
            "id": "example",
            "kind": "example",
            "op": "example",
            "prop": "example",
            "value": "example"
          }
        ],
        "items_op": "example",
        "name": "example",
        "updated_at": "example"
      }
    ]
  }
}
```

### List tour interactions

List who saw a tour and where they got to: started, completed, exited or displayed.

**Inputs**

- Tour (`tour_id`, text, required): The tour.
- Order by (`order`, text): Sort by when each was created or last updated, newest first. Leave empty for created. One of: `created_at` (Created), `updated_at` (Last updated). Default: `created_at`.
- Full user details (`full_profiles`, true/false): Return every property of each user, not just their IDs.
- Records to return (`limit`, number): How many to return, up to 500. Leave empty for 50. From 1 to 500.
- Next page cursor (`before`, text): The cursor's before value from the last page, to read the next page.
- Created after (`created_after`, date and time): Only records created at or after this time.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "cursor": {
      "before": "example",
      "limit": 1
    },
    "interactions": [
      {
        "created_at": "example",
        "goal_at": "example",
        "group_kind": "example",
        "id": "example",
        "profile": {
          "email": "example",
          "id": "example",
          "uid": "example"
        },
        "state": "example",
        "tour_id": "example",
        "updated_at": "example"
      }
    ]
  }
}
```

### List tours

List tours with their publish state and how many users started, completed and exited them.

**Inputs**

- Records to return (`limit`, number): How many to return, up to 500. Leave empty for 50. From 1 to 500.
- Next page cursor (`before`, text): The cursor's before value from the last page, to read the next page.
- Created after (`created_after`, date and time): Only records created at or after this time.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "cursor": {
      "before": "example",
      "limit": 1
    },
    "tours": [
      {
        "created_at": "example",
        "dashboard_url": "example",
        "id": "example",
        "name": "example",
        "position": 1,
        "published_at": "example",
        "scheduled_publish_at": "example",
        "scheduled_unpublish_at": "example",
        "segment_ids": [
          "example"
        ],
        "stats": {
          "completed_count": 1,
          "exited_count": 1,
          "last_completed_at": "example",
          "last_exited_at": "example",
          "last_started_at": "example",
          "started_count": 1
        },
        "style": "example",
        "tag_ids": [
          "example"
        ],
        "updated_at": "example"
      }
    ]
  }
}
```

### List webhooks

List the account's webhooks with when each last ran and whether it worked.

**Inputs**: None.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "webhooks": [
      {
        "id": "example",
        "last_item_at": "example",
        "last_item_error": "example",
        "last_item_state": "example",
        "name": "example",
        "uid": "example"
      }
    ]
  }
}
```

### Search users

Find the users in a segment, or matching filters on their properties and what they did in Chameleon.

**Inputs**

- Segment (`segment_id`, text): Only users in this segment.
- Filters (`filters`, list): Chameleon filter expressions, such as {"kind": "property", "prop": "role", "op": "eq", "value": "admin"}.
- Match (`filters_op`, text): Whether every filter or any filter must match. Leave empty for every filter. One of: `and` (All filters match), `or` (Any filter matches). Default: `and`.
- Full user details (`full_profiles`, true/false): Return every property of each user, not just their IDs.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "profiles": [
      {
        "browser_k": "example",
        "browser_l": "example",
        "company_id": "example",
        "created_at": "example",
        "delivery_ids": [
          "example"
        ],
        "email": "example",
        "id": "example",
        "last_seen_at": "example",
        "last_seen_session_count": 1,
        "uid": "example",
        "updated_at": "example"
      }
    ]
  }
}
```

### Show tour or microsurvey to user

Show a published tour or microsurvey to one user the next time they load a page (a delivery).

**Inputs**

- Show a (`model_kind`, text, required): Whether it's a tour or a microsurvey. One of: `tour`, `survey` (Microsurvey).
- Tour or microsurvey (`model_id`, text, required): The tour or microsurvey. It must be published.
- Find user by (`find_by`, text): What the user is looked up by. Leave empty for their user ID. One of: `uid` (User ID), `email` (Email address), `id` (Chameleon ID). Default: `uid`.
- User (`profile`, text, required): The user's ID from your product, email address or Chameleon ID, matching Find user by.
- Personalization (`options`, object): Values for the experience's merge tags, by name, such as title or button text.
- Show from (`starts_at`, date and time): Don't show it before this time.
- Show until (`ends_at`, date and time): Don't show it after this time.
- Only if not seen before (`once`, true/false): Skip it if the user has seen it before.
- Check its segment (`use_segmentation`, true/false): Only show it if the user is in its segment at that moment.
- Only once per key (`idempotency_key`, text): A key that makes sure this user gets this at most once, however many times the step runs.
- Replace the oldest if full (`replace_oldest`, true/false): When the user already has the most pending deliveries (3), drop their oldest instead of failing.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "delivery": {
      "at": "example",
      "created_at": "example",
      "id": "example",
      "idempotency_key": "example",
      "interaction_id": "example",
      "model_id": "example",
      "model_kind": "example",
      "once": true,
      "options": {},
      "profile_id": "example",
      "use_segmentation": true
    }
  }
}
```

### Track event

Record an event a user did, for segmenting, goals and launcher items.

**Inputs**

- User ID (`uid`, text, required): The user's ID in your product. A user Chameleon hasn't seen is created.
- Event name (`name`, text, required): The event's name, such as Completed onboarding.
- Event properties (`properties`, object): Details of the event, by name, such as plan or amount.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "event": {
      "id": "example"
    }
  }
}
```

### Update microsurvey

Publish or unpublish a microsurvey, or add or remove a tag or environment.

**Inputs**

- Microsurvey (`survey_id`, text, required): The microsurvey.
- Publish (`publish`, text): Publish it now, so it starts showing, or unpublish it. One of: `publish` (Publish now), `unpublish`.
- Add tag (`add_tag`, text): A tag to add.
- Remove tag (`remove_tag`, text): A tag to remove.
- Add environment (`add_environment`, text): An environment to show it in.
- Remove environment (`remove_environment`, text): An environment to stop showing it in.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "survey": {
      "created_at": "example",
      "dashboard_url": "example",
      "id": "example",
      "name": "example",
      "position": 1,
      "published_at": "example",
      "scheduled_publish_at": "example",
      "scheduled_unpublish_at": "example",
      "segment_ids": [
        "example"
      ],
      "stats": {
        "completed_count": 1,
        "exited_count": 1,
        "last_completed_at": "example",
        "last_exited_at": "example",
        "last_started_at": "example",
        "started_count": 1
      },
      "tag_ids": [
        "example"
      ],
      "updated_at": "example"
    }
  }
}
```

### Update tour

Publish or unpublish a tour, or add or remove a tag or environment.

**Inputs**

- Tour (`tour_id`, text, required): The tour.
- Publish (`publish`, text): Publish it now, so it starts showing, or unpublish it. One of: `publish` (Publish now), `unpublish`.
- Add tag (`add_tag`, text): A tag to add.
- Remove tag (`remove_tag`, text): A tag to remove.
- Add environment (`add_environment`, text): An environment to show it in.
- Remove environment (`remove_environment`, text): An environment to stop showing it in.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "tour": {
      "created_at": "example",
      "dashboard_url": "example",
      "id": "example",
      "name": "example",
      "position": 1,
      "published_at": "example",
      "scheduled_publish_at": "example",
      "scheduled_unpublish_at": "example",
      "segment_ids": [
        "example"
      ],
      "stats": {
        "completed_count": 1,
        "exited_count": 1,
        "last_completed_at": "example",
        "last_exited_at": "example",
        "last_started_at": "example",
        "started_count": 1
      },
      "style": "example",
      "tag_ids": [
        "example"
      ],
      "updated_at": "example"
    }
  }
}
```
