# AskNicely

> Send NPS surveys, manage contacts, and read responses and scores.

App · 11 actions. Web page: https://docs.lodol.com/docs/integrations/asknicely

## Actions

### Add contacts in bulk

Add or update many contacts at once. AskNicely processes them shortly after.

**Inputs**

- Contacts (`contacts`, list, required): The contacts, each with an email and optionally a name, a segment and custom fields ending in _c.
- Send surveys (`send_surveys`, true/false): Also send a survey to each contact your contact rules allow. Default: `false`.

**Outputs**

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

**Example output**

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

### Add or update contact

Add a contact to AskNicely, or update the one with this email, without sending a survey.

**Inputs**

- Email (`email`, text, required): The contact's email address.
- Name (`name`, text): The contact's full name. Leave empty to give a first and last name instead.
- First name (`first_name`, text): The contact's first name.
- Last name (`last_name`, text): The contact's last name.
- Segment (`segment`, text): The segment to put the contact in, such as VIP Customer.
- Custom fields (`custom_fields`, object): Custom data for the contact, as names and values, such as city: Portland. Each name is sent with AskNicely's _c ending.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "result": [
      {
        "email": "example",
        "id": "example",
        "msg": "example",
        "survey_sent": true
      }
    ],
    "success": true,
    "surveys_sent": 1
  }
}
```

### Deactivate contact

Make a contact inactive so they get no more surveys. Adding them again reactivates them.

**Inputs**

- Email or value (`value`, text, required): What to look the contact up by: their email address, or the value of the field chosen in Match field.
- Match field (`match_field`, text): The contact field to match: email, id, or a custom field such as branch_location_c. Default: `email`.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "data": {
      "active": "example",
      "created": "example",
      "email": "example",
      "id": "example",
      "importedattime": "example",
      "lastemailed": "example",
      "name": "example",
      "scheduled": "example",
      "segment": "example",
      "source": "example",
      "unsubscribetime": "example"
    },
    "msg": "example",
    "success": true
  }
}
```

### Erase contacts' personal data

Remove all personal data of these contacts (a GDPR erasure) and block them from being added or surveyed again. This can't be undone.

**Inputs**

- Emails (`emails`, list, required): The email addresses of the contacts to erase.
- Notify account owner (`notify_account_owner`, true/false): Email the account's main user that the contacts were erased. Default: `true`.

**Outputs**

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

**Example output**

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

### Get contact

Look up a contact by email, ID or another field.

**Inputs**

- Email or value (`value`, text, required): What to look the contact up by: their email address, or the value of the field chosen in Match field.
- Match field (`match_field`, text): The contact field to match: email, id, or a custom field such as branch_location_c. Default: `email`.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "data": {
      "active": "example",
      "created": "example",
      "email": "example",
      "id": "example",
      "importedattime": "example",
      "lastemailed": "example",
      "name": "example",
      "scheduled": "example",
      "segment": "example",
      "source": "example",
      "unsubscribetime": "example"
    },
    "success": true
  }
}
```

### Get daily statistics

Get sent, opened and answered counts and the NPS, day by day.

**Inputs**

- Day (`date`, date): Only this day. Leave empty for every day.
- Segment (`segment`, text): Only contacts in this segment.
- Sent after (`sent_after`, date and time): Only surveys sent at or after this time.
- Sent before (`sent_before`, date and time): Only surveys sent at or before this time.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "data": [
      {
        "comment_length": "example",
        "comment_responded_percent": "example",
        "csat": "example",
        "day": "example",
        "delivered": "example",
        "detractors": "example",
        "fivestar": "example",
        "month": "example",
        "nps": "example",
        "opened": "example",
        "passives": "example",
        "promoters": "example",
        "responded": "example",
        "sent": "example",
        "surveys_opened_responded_percent": "example",
        "surveys_responded_percent": "example",
        "weekday": "example",
        "year": "example"
      }
    ],
    "success": true
  }
}
```

### Get NPS

Get your Net Promoter Score over the last days.

**Inputs**

- Days (`days`, number): How many days back from today to count. At least 1. Default: `30`.
- Custom field filters (`filters`, object): Count only contacts whose custom data matches, as names and values, such as country: Canada. Every pair must match.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "NPS": "example"
  }
}
```

### Get survey statistics

Count the surveys sent, delivered, opened and answered over the last days, with promoters, passives and detractors.

**Inputs**

- Days (`days`, number): How many days back from today to count. At least 1. Default: `30`.
- Question type (`question_type`, text): Count only surveys that lead with this kind of question. One of: `nps`, `csat`, `fivestar` (5 star).
- Custom field filters (`filters`, object): Count only contacts whose custom data matches, as names and values, such as country: Canada. Every pair must match.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "delivered": 1,
    "detractors": 1,
    "opened": 1,
    "passives": 1,
    "promoters": 1,
    "responded": 1,
    "responserate": "example",
    "sent": 1
  }
}
```

### List responses

List survey responses with each contact's answer, comment and dates.

**Inputs**

- Since (`since`, date and time): Only responses after this time. Leave empty for all.
- Until (`until`, date and time): Only responses before this time. Leave empty for up to now.
- Include (`include`, text): Which surveys to list. One of: `answered` (Answered surveys), `raw` (Every survey sent), `published` (Published testimonials). Default: `answered`.
- Sort by (`sort_by`, text): The date Since, Until and the order go by. One of: `sent` (Date sent), `responded` (Date answered). Default: `sent`.
- Order (`order`, text): The order of the responses. One of: `desc` (Newest first), `asc` (Oldest first). Default: `desc`.
- Page (`page`, number): The page to read, starting at 1. At least 1. Default: `1`.
- Page size (`page_size`, number): Responses per page, up to 999. From 1 to 999. Default: `100`.
- Include case closed time (`include_case_status`, true/false): Also return when each response's case was closed. Default: `false`.
- Custom field filters (`filters`, object): Count only contacts whose custom data matches, as names and values, such as country: Canada. Every pair must match.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "data": [
      {
        "answer": "example",
        "answerlabel": "example",
        "case_closed_time": "example",
        "comment": "example",
        "contact_id": "example",
        "created": "example",
        "email": "example",
        "lastemailed": "example",
        "name": "example",
        "note": "example",
        "opened": "example",
        "person_id": "example",
        "published": "example",
        "publishedname": "example",
        "question_type": "example",
        "responded": "example",
        "response_id": "example",
        "segment": "example",
        "sent": "example",
        "status": "example",
        "survey_template": "example"
      }
    ],
    "end_time": "example",
    "pagenumber": "example",
    "pagesize": "example",
    "since_time": "example",
    "success": true,
    "total": "example",
    "totalpages": "example"
  }
}
```

### List unsubscribed contacts

List the contacts who unsubscribed from AskNicely surveys.

**Inputs**

- Page (`page`, number): The page to read, starting at 1. At least 1. Default: `1`.
- Page size (`page_size`, number): Contacts per page. From 1 to 1000. Default: `1000`.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "data": [
      {
        "email": "example",
        "id": "example",
        "unsubscribetime": "example"
      }
    ],
    "success": true
  }
}
```

### Send survey

Add or update a contact and send them a survey, if your contact rules allow it.

**Inputs**

- Email (`email`, text, required): The contact's email address.
- Name (`name`, text): The contact's full name. Leave empty to give a first and last name instead.
- First name (`first_name`, text): The contact's first name.
- Last name (`last_name`, text): The contact's last name.
- Segment (`segment`, text): The segment to put the contact in, such as VIP Customer.
- Custom fields (`custom_fields`, object): Custom data for the contact, as names and values, such as city: Portland. Each name is sent with AskNicely's _c ending.
- Delay (minutes) (`delay_minutes`, number): Wait this many minutes before sending. A text survey accepts 15 to 50400 (35 days). At least 0.
- Ignore contact rules (`ignore_contact_rules`, true/false): Send even if the contact was surveyed recently. AskNicely advises this for testing only. Default: `false`.
- Deactivate after sending (`deactivate_after`, true/false): Deactivate the contact once the survey is sent, so the daily scheduler skips them. Needs Ignore contact rules on. Default: `false`.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "result": [
      {
        "email": "example",
        "id": "example",
        "msg": "example",
        "survey_sent": true
      }
    ],
    "success": true,
    "surveys_sent": 1
  }
}
```
