From bb7b400562054866d909d211000d9dde5a70ec7c Mon Sep 17 00:00:00 2001 From: Marcos Defendi Date: Fri, 4 Oct 2019 14:20:23 -0300 Subject: [PATCH 1/2] Added docs for livechat/triggersendpoint --- _data/toc.yml | 1 + .../documentation/documentation-map/README.md | 1 + developer-guides/rest-api/livechat/README.md | 2 + .../rest-api/livechat/triggers/README.md | 114 ++++++++++++++++++ 4 files changed, 118 insertions(+) create mode 100644 developer-guides/rest-api/livechat/triggers/README.md diff --git a/_data/toc.yml b/_data/toc.yml index 2b0c8242fd..7d1f18c37b 100644 --- a/_data/toc.yml +++ b/_data/toc.yml @@ -403,6 +403,7 @@ - room - rooms - sms-incoming + - triggers - users - video-call - visitor diff --git a/contributing/documentation/documentation-map/README.md b/contributing/documentation/documentation-map/README.md index 66bbc30c7b..dac5089e02 100644 --- a/contributing/documentation/documentation-map/README.md +++ b/contributing/documentation/documentation-map/README.md @@ -398,6 +398,7 @@ Here you can also find what articles are incomplete and missing. - room - rooms - sms-incoming + - triggers - users - video-call - Miscellaneous: diff --git a/developer-guides/rest-api/livechat/README.md b/developer-guides/rest-api/livechat/README.md index 5d94fd3d44..90b1f2f8b1 100644 --- a/developer-guides/rest-api/livechat/README.md +++ b/developer-guides/rest-api/livechat/README.md @@ -33,6 +33,8 @@ Manage Livechat related data: | `/api/v1/livechat/room.forward` | `POST` | Allow Livechat Agents to forward a Livechat room to another agent, department or return it back to the Queue. | [info](room/index.html#forward-livechat-room) | | `/api/v1/livechat/room.survey` | `POST` | Send a Livechat survey to Rocket.Chat. | [info](room/index.html#send-the-livechat-survey) | | `/api/v1/livechat/transcript` | `POST` | Request a Livechat transcript. | [info](transcript/) | +| `/api/v1/livechat/triggers` | `GET` | Get the Livechat triggers. | [info](triggers/) | +| `/api/v1/livechat/triggers/:_id` | `GET` | Get a Livechat trigger. | [info](triggers/) | | `/api/v1/livechat/video.call/:token` | `GET` | Request a new video call room. | [info](video-call/) | | `/api/v1/livechat/visitor` | `POST` | Register a new Livechat visitor. | [info](visitor/index.html) | | `/api/v1/livechat/visitor/:token` | `GET` | Retrieve a visitor data. | [info](visitor/index.html) | diff --git a/developer-guides/rest-api/livechat/triggers/README.md b/developer-guides/rest-api/livechat/triggers/README.md new file mode 100644 index 0000000000..29f43976bd --- /dev/null +++ b/developer-guides/rest-api/livechat/triggers/README.md @@ -0,0 +1,114 @@ +# Livechat Triggers + +## Get the Livechat Triggers + +Lists all Livechat triggers. It supports the [Offset, Count, and Sort Query Parameters](../../offset-and-count-and-sort-info/). + +| URL | Requires Auth | HTTP Method | +| :----------------------------------- | :------------ | :---------- | +| `/api/v1/livechat/triggers` | `yes` | `GET` | + +## Example Call + +```bash +curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ + -H "X-User-Id: aobEdbYhXfu5hkeqG" \ + http://localhost:3000/api/v1/livechat/triggers +``` + + +## Example Result + +```json +{ + "triggers": [ + { + "_id": "Lk52shJFYyb55trw8", + "name": "test", + "description": "test", + "enabled": true, + "runOnce": true, + "conditions": [ + { + "name": "page-url", + "value": "" + } + ], + "actions": [ + { + "name": "send-message", + "params": { + "sender": "", + "msg": "" + } + } + ], + "_updatedAt": "2019-10-04T15:36:29.695Z" + } + ], + "count": 1, + "offset": 0, + "total": 1, + "success": true +} +``` + +## Change Log + +| Version | Description | +| :------ | :---------- | +| 2.2.0 | Added | + +## Get a Livechat Trigger + +Get a Livechat Trigger by id. + +| URL | Requires Auth | HTTP Method | +| :----------------------------------- | :------------ | :---------- | +| `/api/v1/livechat/triggers/:_id` | `yes` | `GET` | + +## Example Call + +```bash +curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ + -H "X-User-Id: aobEdbYhXfu5hkeqG" \ + http://localhost:3000/api/v1/livechat/triggers/Lk52shJFYyb55trw8 +``` + + +## Example Result + +```json +{ + "trigger": { + "_id": "Lk52shJFYyb55trw8", + "name": "test", + "description": "test", + "enabled": true, + "runOnce": true, + "conditions": [ + { + "name": "page-url", + "value": "" + } + ], + "actions": [ + { + "name": "send-message", + "params": { + "sender": "", + "msg": "" + } + } + ], + "_updatedAt": "2019-10-04T15:36:29.695Z" + }, + "success": true +} +``` + +## Change Log + +| Version | Description | +| :------ | :---------- | +| 2.2.0 | Added | \ No newline at end of file From 78b3f64ddc781f06e11afcfe10b01d5cc4d58aa6 Mon Sep 17 00:00:00 2001 From: Marcos Defendi Date: Fri, 4 Oct 2019 14:31:13 -0300 Subject: [PATCH 2/2] Fix lint --- developer-guides/rest-api/livechat/triggers/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/developer-guides/rest-api/livechat/triggers/README.md b/developer-guides/rest-api/livechat/triggers/README.md index 29f43976bd..93dc7aa52f 100644 --- a/developer-guides/rest-api/livechat/triggers/README.md +++ b/developer-guides/rest-api/livechat/triggers/README.md @@ -16,7 +16,6 @@ curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ http://localhost:3000/api/v1/livechat/triggers ``` - ## Example Result ```json @@ -59,7 +58,7 @@ curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ | :------ | :---------- | | 2.2.0 | Added | -## Get a Livechat Trigger +## Get a Livechat Trigger Get a Livechat Trigger by id. @@ -75,7 +74,6 @@ curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ http://localhost:3000/api/v1/livechat/triggers/Lk52shJFYyb55trw8 ``` - ## Example Result ```json