Update customer
Specifics| Action | update_customer |
| Web API equivalent | update_customer |
| Push message | customer_updated |
| 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. |
omnichannel | No | object | |
omnichannel.fbmessenger | No | object | |
omnichannel.fbmessenger.id | Yes | string | Required when omnichannel.fbmessenger is included. |
omnichannel.fbmessenger.name | No | string | |
omnichannel.fbmessenger.first_name | No | string | |
omnichannel.fbmessenger.last_name | No | string | |
omnichannel.fbmessenger.profile_pic | No | string | |
omnichannel.fbmessenger.gender | No | string | |
omnichannel.fbmessenger.locale | No | string | |
omnichannel.fbmessenger.is_verified_user | No | bool | |
omnichannel.twilio | No | object | |
omnichannel.twilio.phone_number | Yes | string | Required when omnichannel.twilio is included. |
address | No | object | The customer’s address. |
address.address | No | string | The street address. |
address.city | No | string | The city name. |
address.country | No | string | The country name. |
address.state | No | string | The state name. |
address.postal_code | No | string | The postal code. |
Request
{
"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" }
]
}
}
Response
{
"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 | — |
| Parameter | Required | Type | Notes |
|---|---|---|---|
url | Yes | string | |
title | No | string |
| Field | Data type | Notes |
|---|---|---|
groups | array | Optional. An array of objects with id and status properties. Present only if the customer’s group assignment has changed as a result of this call. Possible statuses: online, online_for_queue, offline. |
Request
{
"action": "update_customer_page",
"payload": {
"url": "https://www.text.com/pricing"
}
}
Response
{
"request_id": "<request_id>",
"action": "update_customer_page",
"type": "response",
"success": true,
"payload": {
"groups": [
{
"id": 1,
"status": "online"
}
]
}
}
Set customer session fields
Specifics| Action | set_customer_session_fields |
| Web API equivalent | set_customer_session_fields |
| Push message | customer_updated |
| 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. |
Request
{
"action": "set_customer_session_fields",
"payload": {
"session_fields": [
{ "custom_key": "custom_value" },
{ "another_custom_key": "another_custom_value" }
]
}
}
Response
{
"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 |
| Push message | — |
| 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. |
phone_number | string | The customer’s phone number. 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. |
omnichannel | object | The customer’s omnichannel data. |
address | object | The customer’s address data. Returned only if set. |
Request
{
"action": "get_customer",
"payload": {}
}
Response
{
"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" }
]
}
}