> ## Documentation Index
> Fetch the complete documentation index at: https://www.text.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Customers

> Reference of Customers methods for the Customer Chat RTM API v3.5.

## Update customer

**Specifics**

| | |
| - | - |
| **Action** | `update_customer` |
| **Web API equivalent** | [`update_customer`](https://www.text.com/docs/api/customer-chat/v3.5/customers/update-customer) |
| **Push message** | `customer_updated` |

**Request**

At least one optional parameter must be included in the request payload.

| Parameter | Required | Type | Notes |
| - | - | - | - |
| `name` | No | `string` | |
| `email` | No | `string` | |
| `avatar` | No | `string` | The URL of the customer's avatar. |
| `session_fields` | No | `[]object` | An array of custom object-enclosed key-value pairs. Respects the order of items. |

No response payload.

```json title="Request" theme={null}
{
  "action": "update_customer",
  "payload": {
    "name": "Thomas Anderson",
    "email": "t.anderson@example.com",
    "avatar": "https://example.com/avatars/1.png",
    "session_fields": [
      { "custom_key": "custom_value" },
      { "another_custom_key": "another_custom_value" }
    ]
  }
}
```

```json title="Response" theme={null}
{
  "request_id": "<request_id>",
  "action": "update_customer",
  "type": "response",
  "success": true,
  "payload": {}
}
```

***

## Update customer page

Updates the page the customer is currently visiting. Agent and referrer are updated by default using the browser's headers.

**Specifics**

| | |
| - | - |
| **Action** | `update_customer_page` |
| **Web API equivalent** | — |
| **Push message** | — |

**Request**

| Parameter | Required | Type | Notes |
| - | - | - | - |
| `url` | Yes | `string` | |
| `title` | No | `string` | |

No response payload.

```json title="Request" theme={null}
{
  "action": "update_customer_page",
  "payload": {
    "url": "https://www.text.com/pricing"
  }
}
```

```json title="Response" theme={null}
{
  "request_id": "<request_id>",
  "action": "update_customer_page",
  "type": "response",
  "success": true,
  "payload": {}
}
```

***

## Set customer session fields

**Specifics**

| | |
| - | - |
| **Action** | `set_customer_session_fields` |
| **Web API equivalent** | [`set_customer_session_fields`](https://www.text.com/docs/api/customer-chat/v3.5/customers/set-customer-session-fields) |
| **Push message** | `customer_updated` |

**Request**

Agent and referrer are updated by default using the browser's headers.

| Parameter | Required | Type | Notes |
| - | - | - | - |
| `session_fields` | Yes | `[]object` | An array of custom object-enclosed key-value pairs. Respects the order of items. Maximum: 100 keys. |

No response payload.

```json title="Request" theme={null}
{
  "action": "set_customer_session_fields",
  "payload": {
    "session_fields": [
      { "custom_key": "custom_value" },
      { "another_custom_key": "another_custom_value" }
    ]
  }
}
```

```json title="Response" theme={null}
{
  "request_id": "<request_id>",
  "action": "set_customer_session_fields",
  "type": "response",
  "success": true,
  "payload": {}
}
```

***

## Get customer

Returns the info about the customer requesting it.

**Specifics**

| | |
| - | - |
| **Action** | `get_customer` |
| **Web API equivalent** | [`get_customer`](https://www.text.com/docs/api/customer-chat/v3.5/customers/get-customer) |
| **Push message** | — |

**Response**

| Field | Type | Notes |
| - | - | - |
| `name` | `string` | The customer's name. Returned only if set. |
| `email` | `string` | The customer's email. Returned only if set. |
| `avatar` | `string` | The customer's avatar. Returned only if set. |
| `session_fields` | `[]object` | An array of custom object-enclosed key-value pairs. Returned only if set. Available for the session duration. |

```json title="Request" theme={null}
{
  "action": "get_customer",
  "payload": {}
}
```

```json title="Response" theme={null}
{
  "request_id": "<request_id>",
  "action": "get_customer",
  "type": "response",
  "success": true,
  "payload": {
    "id": "b7eff798-f8df-4364-8059-649c35c9ed0c",
    "type": "customer",
    "name": "Thomas Anderson",
    "email": "t.anderson@example.com",
    "avatar": "https://example.com/avatars/1.jpg",
    "session_fields": [
      { "custom_key": "custom_value" },
      { "another_custom_key": "another_custom_value" }
    ]
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.