From 2288dfb1b03025672e08d02c341e5ef858093cf7 Mon Sep 17 00:00:00 2001 From: Rachana Visavadiya Date: Sun, 26 Nov 2023 03:58:12 +0000 Subject: [PATCH] GITBOOK-1175: Omnichannel - custom fields --- SUMMARY.md | 8 +-- reference/api/rest-api/endpoints/README.md | 6 +- .../get-custom-field-information.md | 50 +++++++++++++++++ .../get-info-about-a-custom-field.md | 38 ------------- .../get-livechat-custom-fields.md | 55 +++++++++++++++++++ .../list-livechat-custom-fields.md | 49 ----------------- .../send-a-livechat-custom-field.md | 46 ---------------- ...send-an-array-of-livechat-custom-fields.md | 35 +++++------- .../custom-fields/send-custom-field-value.md | 40 ++++++++++++++ 9 files changed, 166 insertions(+), 161 deletions(-) create mode 100644 reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-custom-field-information.md delete mode 100644 reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-info-about-a-custom-field.md create mode 100644 reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-livechat-custom-fields.md delete mode 100644 reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/list-livechat-custom-fields.md delete mode 100644 reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-a-livechat-custom-field.md create mode 100644 reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-custom-field-value.md diff --git a/SUMMARY.md b/SUMMARY.md index 4f5560d3a..700162c77 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -455,10 +455,10 @@ * [Get Available Departments by Unit ID](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/livechat-departments/get-available-departments-by-unit-id.md) * [Get Departments by Unit ID](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/livechat-departments/get-departments-by-unit-id.md) * [Livechat Custom Field](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/README.md) - * [Send a Livechat custom field](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-a-livechat-custom-field.md) - * [Send an array of Livechat custom fields](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-an-array-of-livechat-custom-fields.md) - * [List livechat custom fields](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/list-livechat-custom-fields.md) - * [Get info about a custom field](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-info-about-a-custom-field.md) + * [Send Custom Field Value](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-custom-field-value.md) + * [Send Array of Custom Field Values](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-an-array-of-livechat-custom-fields.md) + * [Get Livechat Custom Fields](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-livechat-custom-fields.md) + * [Get Custom Field Information](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-custom-field-information.md) * [Livechat Audio Video Calls](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/livechat-audio-video-calls/README.md) * [Start Call](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/livechat-audio-video-calls/livechat-start-call.md) * [Update Call Status](reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/livechat-audio-video-calls/livechat-update-call-status.md) diff --git a/reference/api/rest-api/endpoints/README.md b/reference/api/rest-api/endpoints/README.md index ad4771c9c..5e98b17e4 100644 --- a/reference/api/rest-api/endpoints/README.md +++ b/reference/api/rest-api/endpoints/README.md @@ -318,10 +318,10 @@ From version 0.50.0 and on, you can call the methods using `dm` instead of `im`. | Url | Short Description | Details Page | | ----------------------------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `livechat/custom.field` | Sends a custom field | [Link](omnichannel/livechat-endpoints/custom-fields/send-a-livechat-custom-field.md) | +| `livechat/custom.field` | Sends a custom field | [Link](omnichannel/livechat-endpoints/custom-fields/send-custom-field-value.md) | | `livechat/custom.fields` | Sends an array of custom field | [Link](omnichannel/livechat-endpoints/custom-fields/send-an-array-of-livechat-custom-fields.md) | -| `livechat/custom-fields` | Retrieves a list of omnichannel custom fields | [Link](omnichannel/livechat-endpoints/custom-fields/list-livechat-custom-fields.md) | -| `livechat/custom-fields/:_id` | Retrieves info about a custom field | [Link](omnichannel/livechat-endpoints/custom-fields/get-info-about-a-custom-field.md) | +| `livechat/custom-fields` | Retrieves a list of omnichannel custom fields | [Link](omnichannel/livechat-endpoints/custom-fields/get-livechat-custom-fields.md) | +| `livechat/custom-fields/:_id` | Retrieves info about a custom field | [Link](omnichannel/livechat-endpoints/custom-fields/get-custom-field-information.md) | #### Livechat Message diff --git a/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-custom-field-information.md b/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-custom-field-information.md new file mode 100644 index 000000000..3a4f200e4 --- /dev/null +++ b/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-custom-field-information.md @@ -0,0 +1,50 @@ +# Get Custom Field Information + +Get details about a specific custom field. + +
HTTP MethodURLRequires Auth
GET/api/v1/livechat/custom-fields/:_idyes
+ +{% hint style="info" %} +Permission required: `view-l-room` +{% endhint %} + +## Path Variables + +
KeyExample ValueDescription
_id*addressThe custom field ID.
+ +## Example Call + +```bash +curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ + -H "X-User-Id: aobEdbYhXfu5hkeqG" \ + http://localhost:3000/api/v1/livechat/custom-fields/address +``` + +## Example Response + +```json +{ + "customField": { + "_id": "address", + "label": "address", + "scope": "visitor", + "visibility": "visible", + "regexp": "", + "searchable": true, + "type": "input", + "required": false, + "defaultValue": "", + "options": "", + "public": true, + "_updatedAt": "2023-10-30T13:43:09.408Z", + "id": "address" + }, + "success": true +} +``` + +## Change Log + +| Version | Description | +| ------- | ----------- | +| 2.4.0 | Added | diff --git a/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-info-about-a-custom-field.md b/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-info-about-a-custom-field.md deleted file mode 100644 index 8b9ef1663..000000000 --- a/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-info-about-a-custom-field.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -description: Get info about a custom field. ---- - -# Get info about a custom field - -| URL | Requires Auth | HTTP Method | -| ------------------------------------- | ------------- | ----------- | -| `/api/v1/livechat/custom-fields/:_id` | `yes` | `GET` | - -## Example Call - -```bash -curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ - -H "X-User-Id: aobEdbYhXfu5hkeqG" \ - http://localhost:3000/api/v1/livechat/custom-fields/address -``` - -## Example Result - -```javascript -{ - "customField": { - "_id": "address", - "label": "address", - "scope": "visitor", - "visibility": "visible", - "_updatedAt": "2019-10-03T14:12:47.595Z" - }, - "success": true -} -``` - -## Change Log - -| Version | Description | -| ------- | ----------- | -| 2.4.0 | Added | diff --git a/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-livechat-custom-fields.md b/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-livechat-custom-fields.md new file mode 100644 index 000000000..b0240a02c --- /dev/null +++ b/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/get-livechat-custom-fields.md @@ -0,0 +1,55 @@ +# Get Livechat Custom Fields + +Get a list of the Livechat custom fields. + +
HTTP MethodURLRequires Auth
GET/api/v1/livechat/custom-fieldsyes
+ +{% hint style="info" %} +Permission required: `view-l-room` +{% endhint %} + +## Query Parameters + +This endpoint supports the [#pagination](../../../../#pagination "mention") query parameters. + +## Example Call + +```powershell +curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ + -H "X-User-Id: aobEdbYhXfu5hkeqG" \ + http://localhost:3000/api/v1/livechat/custom-fields +``` + +## Example Response + +```json +{ + "customFields": [ + { + "_id": "address", + "label": "address", + "scope": "visitor", + "visibility": "visible", + "regexp": "", + "searchable": true, + "type": "input", + "required": false, + "defaultValue": "", + "options": "", + "public": true, + "_updatedAt": "2023-10-30T13:43:09.408Z", + "id": "address" + } + ], + "count": 1, + "offset": 0, + "total": 1, + "success": true +} +``` + +## Change Log + +| Version | Description | +| ------- | ----------- | +| 2.2.0 | Added | diff --git a/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/list-livechat-custom-fields.md b/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/list-livechat-custom-fields.md deleted file mode 100644 index 260027451..000000000 --- a/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/list-livechat-custom-fields.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -description: Get a list of Livechat custom fields. ---- - -# List livechat custom fields - -It supports the [#pagination](../../../../#pagination "mention") parameters. - - - -| URL | Requires Auth | HTTP Method | -| -------------------------------- | ------------- | ----------- | -| `/api/v1/livechat/custom-fields` | `yes` | `GET` | - -## Example Call - -```bash -curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ - -H "X-User-Id: aobEdbYhXfu5hkeqG" \ - http://localhost:3000/api/v1/livechat/custom-fields -``` - -## Example Result - -```javascript -{ - "customFields": [ - { - "_id": "address", - "label": "address", - "scope": "visitor", - "visibility": "visible", - "_updatedAt": "2019-10-03T14:12:47.595Z" - } - ], - "count": 1, - "offset": 0, - "total": 1, - "success": true -} -``` - -## Change Log - -| Version | Description | -| ------- | ----------- | -| 2.2.0 | Added | - -## diff --git a/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-a-livechat-custom-field.md b/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-a-livechat-custom-field.md deleted file mode 100644 index 815bd02f2..000000000 --- a/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-a-livechat-custom-field.md +++ /dev/null @@ -1,46 +0,0 @@ -# Send a Livechat custom field - -| URL | Requires Auth | HTTP Method | -| ------------------------------- | ------------- | ----------- | -| `/api/v1/livechat/custom.field` | `no` | `POST` | - -## Example payload - -```javascript -{ - "token": "iNKE8a6k6cjbqWhWd", - "key": "address", - "value": "Rocket.Chat Avenue", - "overwrite": true -} -``` - -## Example Call - -```bash -curl -X POST \ - -H "Content-type:application/json" \ - http://localhost:3000/api/v1/livechat/custom.field \ - -d '{"token": "iNKE8a6k6cjbqWhWd", "key": "address", "value": "Rocket.Chat Avenue", "overwrite": true}' -``` - -## Example Result - -```javascript -{ - "field": { - "key": "address", - "value": "Rocket.Chat Avenue", - "overwrite": true - }, - "success": true -} -``` - -## Change Log - -| Version | Description | -| ------- | ----------- | -| 0.70.0 | Added | - -## diff --git a/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-an-array-of-livechat-custom-fields.md b/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-an-array-of-livechat-custom-fields.md index 640743f84..828ddb967 100644 --- a/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-an-array-of-livechat-custom-fields.md +++ b/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-an-array-of-livechat-custom-fields.md @@ -1,34 +1,29 @@ -# Send an array of Livechat custom fields +# Send Array of Custom Field Values -| URL | Requires Auth | HTTP Method | -| -------------------------------- | ------------- | ----------- | -| `/api/v1/livechat/custom.fields` | `no` | `POST` | +Send an array of values for different custom fields. -## Example payload +
HTTP MethodURLRequires Auth
POST/api/v1/livechat/custom.fieldsno
-```javascript -{ - "token": "iNKE8a6k6cjbqWhWd", - "customFields": [{ - "key": "address", - "value": "Rocket.Chat Avenue", - "overwrite": true - }] -} -``` +## Body Parameters + +
KeyExample ValueDescription
token*iNKE8a6k6cjbqWhWdThe visitor token.
customFields*"customFields": [{ ... }] }The object in which you must enter the custom field information.
key*addressThe custom field.
value*Rocket.Chat AvenueThe value you want to set for the custom field.
overwrite*trueOverwrite the value of the custom field.
## Example Call -```bash +```powershell curl -X POST \ -H "Content-type:application/json" \ http://localhost:3000/api/v1/livechat/custom.fields \ - -d '{"token": "iNKE8a6k6cjbqWhWd", "customFields": [{"key": "address", "value": "Rocket.Chat Avenue", "overwrite": true}]}' + -d '{"token": "iNKE8a6k6cjbqWhWd", + "customFields": [{ + "key": "address", + "value": "Rocket.Chat Avenue", + "overwrite": true}]}' ``` -## Example Result +## Example Response -```javascript +```json { "fields": [ { @@ -46,5 +41,3 @@ curl -X POST \ | Version | Description | | ------- | ----------- | | 0.70.0 | Added | - -## diff --git a/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-custom-field-value.md b/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-custom-field-value.md new file mode 100644 index 000000000..53b57b692 --- /dev/null +++ b/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/custom-fields/send-custom-field-value.md @@ -0,0 +1,40 @@ +# Send Custom Field Value + +Send the value for a custom field. + +
HTTP MethodURLRequires Auth
POST/api/v1/livechat/custom.fieldno
+ +## Body Parameters + +
KeyExample ValueDescription
token*iNKE8a6k6cjbqWhWdThe visitor token.
key*addressThe custom field.
value*Rocket.Chat AvenueThe value you want to set for the custom field.
overwrite*trueOverwrite the value of the custom field.
+ +## Example Call + +```powershell +curl -X POST \ + -H "Content-type:application/json" \ + http://localhost:3000/api/v1/livechat/custom.field \ + -d '{"token": "iNKE8a6k6cjbqWhWd", + "key": "address", + "value": "Rocket.Chat Avenue", + "overwrite": true}' +``` + +## Example Response + +```json +{ + "field": { + "key": "address", + "value": "Rocket.Chat Avenue", + "overwrite": true + }, + "success": true +} +``` + +## Change Log + +| Version | Description | +| ------- | ----------- | +| 0.70.0 | Added |