# Exotel

> Connect calls and send SMS through Exotel, read call and SMS records and the account balance, look up Indian numbers, list ExoPhones, manage contact center users and pause or resume campaigns.

App · 17 actions. Web page: https://docs.lodol.com/docs/integrations/exotel

## Actions

### Connect two numbers

Call a number (such as an agent's) and, once they answer, connect them to a customer, showing your ExoPhone as the caller ID.

**Inputs**

- Call first (`from_number`, text, required): The number called first, such as your agent's, with the country code.
- Then connect to (`to`, text, required): The customer's number, with the country code.
- Caller (`caller_id`, text, required): The ExoPhone to call from.
- Record (`record`, true/false): Record the conversation.
- Time limit (`time_limit`, number): The longest the call may last, in seconds (up to 14400). From 1 to 14400.
- Ring for (`time_out`, number): How long each number may ring, in seconds. At least 1.
- Reference (`custom_field`, text): Your own reference for the call (up to 128 characters).
- Status callback (`status_callback`, text): An address Exotel posts the call's outcome to.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "AccountSid": "example",
    "AnsweredBy": "example",
    "DateCreated": "example",
    "DateUpdated": "example",
    "Details": {
      "ConversationDuration": 1,
      "Leg1Status": "example",
      "Leg2Status": "example",
      "Legs": [
        {}
      ]
    },
    "Direction": "example",
    "Duration": "example",
    "EndTime": "example",
    "From": "example",
    "ParentCallSid": "example",
    "PhoneNumberSid": "example",
    "Price": "example",
    "RecordingUrl": "example",
    "Sid": "example",
    "StartTime": "example",
    "Status": "example",
    "To": "example"
  }
}
```

### Create user

Add a user to the contact center, with the phone they take calls on.

**Inputs**

- First name (`first_name`, text, required): Their first name, 3 to 20 characters.
- Last name (`last_name`, text, required): Their last name, 3 to 20 characters.
- Email (`email`, text): Their email address.
- Phone (`device_contact_uri`, text): The phone number they take calls on, with the country code.
- Phone name (`device_name`, text): A name for that phone.
- Role (`role`, text): What they can do. Defaults to user. One of: `user`, `supervisor`, `admin`.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "date_created": "example",
    "date_updated": "example",
    "devices": [
      {
        "available": true,
        "contact_uri": "example",
        "id": 1,
        "name": "example",
        "status": "example",
        "type": "example",
        "verified": true
      }
    ],
    "email": "example",
    "email_verified": true,
    "first_name": "example",
    "id": "example",
    "last_login": "example",
    "last_name": "example",
    "role": "example"
  }
}
```

### Delete user

Remove a user from the contact center.

**Inputs**

- User (`exotel_user_id`, text, required): The user's ID, from List users.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "deleted": true,
    "user_id": "example"
  }
}
```

### Get balance

Get the account's wallet balance, currency and pricing plan.

**Inputs**: None.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "AccountSid": "example",
    "BalanceData": {
      "Balance": "example",
      "Currency": "example",
      "DateUpdated": "example",
      "PricingPlan": "example"
    }
  }
}
```

### Get call

Get a call's status, numbers, times, duration, price and recording, with each leg's details.

**Inputs**

- Call SID (`call_sid`, text, required): The call's SID.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "AccountSid": "example",
    "AnsweredBy": "example",
    "DateCreated": "example",
    "DateUpdated": "example",
    "Details": {
      "ConversationDuration": 1,
      "Leg1Status": "example",
      "Leg2Status": "example",
      "Legs": [
        {}
      ]
    },
    "Direction": "example",
    "Duration": "example",
    "EndTime": "example",
    "From": "example",
    "ParentCallSid": "example",
    "PhoneNumberSid": "example",
    "Price": "example",
    "RecordingUrl": "example",
    "Sid": "example",
    "StartTime": "example",
    "Status": "example",
    "To": "example"
  }
}
```

### Get campaign

Get a campaign with its settings and current statistics.

**Inputs**

- Campaign (`campaign_id`, text, required): The campaign's ID, from List campaigns.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "campaign": {}
  }
}
```

### Get ExoPhone

Get an ExoPhone's number, capabilities and the flow it runs.

**Inputs**

- ExoPhone (`exophone_sid`, text, required): The ExoPhone.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "capabilities": {
      "sms": true,
      "voice": true
    },
    "country": "example",
    "friendly_name": "example",
    "phone_number": "example",
    "region": "example",
    "sid": "example",
    "sms_url": "example",
    "voice_url": "example"
  }
}
```

### Get SMS

Get a text message's delivery status and price.

**Inputs**

- SMS SID (`sms_sid`, text, required): The message's SID.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "AccountSid": "example",
    "Body": "example",
    "DateCreated": "example",
    "DateSent": "example",
    "DateUpdated": "example",
    "DetailedStatus": "example",
    "DetailedStatusCode": "example",
    "Direction": "example",
    "From": "example",
    "Price": "example",
    "Sid": "example",
    "SmsUnits": 1,
    "Status": "example",
    "To": "example",
    "Uri": "example"
  }
}
```

### Get user

Get a contact center user and their devices.

**Inputs**

- User (`exotel_user_id`, text, required): The user's ID, from List users.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "date_created": "example",
    "date_updated": "example",
    "devices": [
      {
        "available": true,
        "contact_uri": "example",
        "id": 1,
        "name": "example",
        "status": "example",
        "type": "example",
        "verified": true
      }
    ],
    "email": "example",
    "email_verified": true,
    "first_name": "example",
    "id": "example",
    "last_login": "example",
    "last_name": "example",
    "role": "example"
  }
}
```

### List calls

List calls, newest first, filtered by date, status, direction or number. Exotel keeps six months, up to a month per request.

**Inputs**

- From (`created_from`, date and time): Only calls made on or after this time.
- To (`created_to`, date and time): Only calls made on or before this time.
- Status (`status`, text): Only calls that ended this way. One of: `completed`, `failed`, `busy`, `no-answer` (Not answered).
- Direction (`direction`, text): Only incoming or outgoing calls. One of: `inbound`, `outbound-dial` (Outbound (dialled)), `outbound-api` (Outbound (API)).
- To number (`to`, text): Only calls to these numbers (up to 5, separated by commas).
- From number (`from_number`, text): Only calls from these numbers (up to 5, separated by commas).
- ExoPhone (`exophone`, text): Only calls on these ExoPhones (up to 5, separated by commas).
- Page size (`page_size`, number): How many per page, up to 100. Exotel's default is 50. From 1 to 100.
- Order (`sort`, text): Newest or oldest first. Newest unless chosen. One of: `DateCreated:desc` (Newest first), `DateCreated:asc` (Oldest first).
- Next page (`after`, text): The next_page from an earlier page.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "Calls": [
      {
        "AccountSid": "example",
        "AnsweredBy": "example",
        "DateCreated": "example",
        "DateUpdated": "example",
        "Details": {
          "ConversationDuration": 1,
          "Leg1Status": "example",
          "Leg2Status": "example",
          "Legs": [
            {}
          ]
        },
        "Direction": "example",
        "Duration": "example",
        "EndTime": "example",
        "From": "example",
        "ParentCallSid": "example",
        "PhoneNumberSid": "example",
        "Price": "example",
        "RecordingUrl": "example",
        "Sid": "example",
        "StartTime": "example",
        "Status": "example",
        "To": "example"
      }
    ],
    "Metadata": {
      "FirstPageUri": "example",
      "NextPageUri": "example",
      "PageSize": 1,
      "PrevPageUri": "example",
      "Total": 1
    },
    "next_page": "example"
  }
}
```

### List campaigns

List outbound call campaigns, by name or status.

**Inputs**

- Name (`name`, text): Only campaigns with this name.
- Statuses (`status`, text): Only campaigns in these statuses, separated by commas, such as InProgress,Paused.
- Skip (`offset`, number): How many to skip. At least 0.
- How many (`limit`, number): How many to return, up to 500. Exotel's default is 20. From 1 to 500.
- Order (`sort_by`, text): How to sort, such as date_created:desc. One of: `date_created:asc` (Date created:asc), `date_created:desc` (Date created:desc), `name:asc`, `name:desc`.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "items": [
      {}
    ],
    "metadata": {
      "count": 1,
      "limit": 1,
      "offset": 1,
      "total": 1
    }
  }
}
```

### List ExoPhones

List the account's ExoPhones (virtual numbers) and what each can do.

**Inputs**: None.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "incoming_phone_numbers": [
      {
        "capabilities": {
          "sms": true,
          "voice": true
        },
        "country": "example",
        "friendly_name": "example",
        "phone_number": "example",
        "region": "example",
        "sid": "example",
        "sms_url": "example",
        "voice_url": "example"
      }
    ],
    "page": 1,
    "page_size": 1
  }
}
```

### List users

List the contact center's users and, if asked, their devices.

**Inputs**

- Email (`email`, text): Only the user with this email address.
- Include (`fields`, text): Extra details to include, separated by commas: devices, active_call, last_login.
- Skip (`offset`, number): How many to skip. At least 0.
- How many (`limit`, number): How many to return, up to 50. Exotel's default is 20. From 1 to 50.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "items": [
      {
        "date_created": "example",
        "date_updated": "example",
        "devices": [
          {
            "available": true,
            "contact_uri": "example",
            "id": 1,
            "name": "example",
            "status": "example",
            "type": "example",
            "verified": true
          }
        ],
        "email": "example",
        "email_verified": true,
        "first_name": "example",
        "id": "example",
        "last_login": "example",
        "last_name": "example",
        "role": "example"
      }
    ],
    "metadata": {
      "count": 1,
      "limit": 1,
      "offset": 1,
      "total": 1
    }
  }
}
```

### Look up Indian number

Get an Indian phone number's operator, telecom circle, type (mobile or landline) and Do Not Disturb status.

**Inputs**

- Phone number (`phone_number`, text, required): The Indian phone number.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "Circle": "example",
    "CircleName": "example",
    "DND": "example",
    "Operator": "example",
    "OperatorName": "example",
    "PhoneNumber": "example",
    "Type": "example"
  }
}
```

### Pause, resume or end campaign

Pause or resume a campaign, complete a paused one, or archive a completed one.

**Inputs**

- Campaign (`campaign_id`, text, required): The campaign's ID, from List campaigns.
- Action (`campaign_action`, text, required): What to do with it. One of: `pause`, `resume`, `complete`, `archive`.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "campaign": {}
  }
}
```

### Send SMS

Send a text message from an ExoPhone or approved sender ID. In India, DLT registration is required.

**Inputs**

- From (`from_number`, text, required): The ExoPhone or approved sender ID to send from.
- To (`to`, text, required): The mobile number to send to, with the country code.
- Message (`body`, text, required): The message, up to 2,000 characters.
- DLT entity ID (`dlt_entity_id`, text): Your DLT entity ID (required for numbers in India).
- DLT template ID (`dlt_template_id`, text): The DLT-approved template's ID.
- Type (`sms_type`, text): What kind of message it is. One of: `transactional` (Transactional (OTP, service)), `transactional_opt_in` (Transactional, opted in), `promotional`.
- Encoding (`encoding`, text): Plain or Unicode. Detected when left empty. One of: `plain`, `unicode`.
- Reference (`custom_field`, text): Your own reference, such as an order ID.
- Status callback (`status_callback`, text): An address Exotel posts the delivery status to.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "AccountSid": "example",
    "Body": "example",
    "DateCreated": "example",
    "DateSent": "example",
    "DateUpdated": "example",
    "DetailedStatus": "example",
    "DetailedStatusCode": "example",
    "Direction": "example",
    "From": "example",
    "Price": "example",
    "Sid": "example",
    "SmsUnits": 1,
    "Status": "example",
    "To": "example",
    "Uri": "example"
  }
}
```

### Update user

Change a user's name, or add their email address if they have none.

**Inputs**

- User (`exotel_user_id`, text, required): The user's ID, from List users.
- First name (`first_name`, text): Their first name, 3 to 20 characters.
- Last name (`last_name`, text): Their last name, 3 to 20 characters.
- Email (`email`, text): Their email address, if they have none yet.

**Outputs**

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

**Example output**

```json
{
  "data": {
    "date_created": "example",
    "date_updated": "example",
    "devices": [
      {
        "available": true,
        "contact_uri": "example",
        "id": 1,
        "name": "example",
        "status": "example",
        "type": "example",
        "verified": true
      }
    ],
    "email": "example",
    "email_verified": true,
    "first_name": "example",
    "id": "example",
    "last_login": "example",
    "last_name": "example",
    "role": "example"
  }
}
```
