From 6fff83ab37cda7d1b8645deef7c30fffbd616770 Mon Sep 17 00:00:00 2001 From: Marcos Spessatto Defendi Date: Wed, 12 Jun 2019 12:10:07 -0300 Subject: [PATCH] [NEW] Docs to Rest livechat inquiries endpoints (#1335) * Docs to Rest livechat inquiries endpoints * Fix inquiries docs * Update inquiries docs * Remove extra blank line --- _data/toc.yml | 2 + .../documentation/documentation-map/README.md | 2 + developer-guides/rest-api/README.md | 7 +++ developer-guides/rest-api/livechat/README.md | 2 + .../livechat/inquiries-list/README.md | 56 +++++++++++++++++ .../livechat/inquiries-take/README.md | 62 +++++++++++++++++++ 6 files changed, 131 insertions(+) create mode 100644 developer-guides/rest-api/livechat/inquiries-list/README.md create mode 100644 developer-guides/rest-api/livechat/inquiries-take/README.md diff --git a/_data/toc.yml b/_data/toc.yml index 2dfff46457..e7682036c2 100644 --- a/_data/toc.yml +++ b/_data/toc.yml @@ -394,6 +394,8 @@ - config - custom-fields - department + - inquiries.list + - inquiries.take - message - room - sms-incoming diff --git a/contributing/documentation/documentation-map/README.md b/contributing/documentation/documentation-map/README.md index 54624df40e..e6edf20f41 100644 --- a/contributing/documentation/documentation-map/README.md +++ b/contributing/documentation/documentation-map/README.md @@ -391,6 +391,8 @@ Here you can also find what articles are incomplete and missing. - config - custom-fields - department + - inquiries.list + - inquiries.take - message - room - sms-incoming diff --git a/developer-guides/rest-api/README.md b/developer-guides/rest-api/README.md index 29e5503325..fea5f7699a 100644 --- a/developer-guides/rest-api/README.md +++ b/developer-guides/rest-api/README.md @@ -201,6 +201,13 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and | `/api/v1/integrations.list` | Lists all of the integrations. | [Link](integration/list/) | | `/api/v1/integrations.remove` | Removes an integration. | [Link](integration/remove/) | +### Livechat + +| Url | Short Description | Details Page | +| :------------------------------- | :------------------------------------------------------------ | :------------------------------- | +| `/api/v1/livechat/inquiries.list`| Retrieves a list of open inquiries. | [Link](livechat/inquiries-list/) | +| `/api/v1/livechat/inquiries.take`| Take an open inquiry. | [Link](livechat/inquiries-take/) | + ### Permissions | Url | Short Description | Details Page | diff --git a/developer-guides/rest-api/livechat/README.md b/developer-guides/rest-api/livechat/README.md index d231d7cab8..aa0026b7f3 100644 --- a/developer-guides/rest-api/livechat/README.md +++ b/developer-guides/rest-api/livechat/README.md @@ -13,6 +13,8 @@ Manage Livechat related data: | `/api/v1/livechat/department/:_id` | `GET` | Retrieve a Livechat department data. | [info](department/index.html#get-info-about-a-department) | | `/api/v1/livechat/department/:_id` | `PUT` | Updates a Livechat department data. | [info](department/index.html#update-a-department) | | `/api/v1/livechat/department/:_id` | `DELETE` | Delete a Livechat department. | [info](department/index.html#removes-a-department) | +| `/api/v1/livechat/inquiries.list` | `GET` | Retrieves a list of open inquiries. | [info](inquiries-list/) | +| `/api/v1/livechat/inquiries.take` | `POST` | Take an open inquiry. | [info](inquiries-take/) | | `/api/v1/livechat/sms-incoming/:service` | `POST` | Send SMS messages to Rocket.Chat. | [info](sms-incoming/) | | `/api/v1/livechat/agent.info/:rid/:token` | `GET` | Retrieve the current Livechat agent data. | [info](agent/index.html) | | `/api/v1/livechat/agent.next/:token` | `GET` | Request the next Livechat agent available. | [info](agent/index.html#request-the-next-livechat-agent-available) | diff --git a/developer-guides/rest-api/livechat/inquiries-list/README.md b/developer-guides/rest-api/livechat/inquiries-list/README.md new file mode 100644 index 0000000000..10baa10c01 --- /dev/null +++ b/developer-guides/rest-api/livechat/inquiries-list/README.md @@ -0,0 +1,56 @@ +# Inquiries List + +Lists all of the open livechat inquiries. It supports the [Offset, Count, and Sort Query Parameters](../../offset-and-count-and-sort-info/). + +| URL | Requires Auth | HTTP Method | +| :--- | :--- | :--- | +| `/api/v1/livechat/inquiries.list` | `yes` | `GET` | + +## Query Parameters + +| Argument | Example | Required | Description | +| :--- | :--- | :--- | :--- | +| `department` | `ByehQjC44FwMeiLbX` | Optional | The department's id or name | + +## Example Call + +```bash +curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ + -H "X-User-Id: aobEdbYhXfu5hkeqG" \ + http://localhost:3000/api/v1/livechat/inquiries.list +``` + +## Example Result + +```json +{ + "inquiries": [ + { + "_id": "GpxfRo8TaPHfsnnC5", + "rid": "EbQjtCosHJWLQmQYT", + "name": "Marcos Defendi", + "ts": "2019-06-11T19:01:57.424Z", + "department": "jHFgdJyJWstB9M2ik", + "status": "open" + }, + { + "_id": "9dCi64GkwWE389xCm", + "rid": "ZpjCcbRwPPdnhKWW5", + "name": "Marcos Defendi", + "ts": "2019-06-11T19:00:43.124Z", + "department": "gDDAjeJb7BhHzzEQ8", + "status": "open" + } + ], + "offset": 0, + "count": 1, + "total": 1, + "success": true +} +``` + +## Change Log + +| Version | Description | +| :--- | :--- | +| 1.2.0 | Added | diff --git a/developer-guides/rest-api/livechat/inquiries-take/README.md b/developer-guides/rest-api/livechat/inquiries-take/README.md new file mode 100644 index 0000000000..fcf51f69cf --- /dev/null +++ b/developer-guides/rest-api/livechat/inquiries-take/README.md @@ -0,0 +1,62 @@ +# Livechat take inquiry + +Takes an open inquiry. + +| URL | Requires Auth | HTTP Method | +| :--- | :--- | :--- | +| `/api/v1/livechat/inquiries.take` | `yes` | `POST` | + +## Payload + +| Argument | Example | Required | Description | +| :--- | :--- | :--- | :--- | +| `inquiryId` | `ByehQjC44FwMeiLbX` | Required | The inquiry's id | +| `userId` | `ByehQjCfsd876sfd` | Optional | The user's (agent) id to take the inquiry. | + +
+ +**Note: if the user id is provided, the user must have the `view-l-room` permission.** + +## Example Call + +```bash +curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ + -H "X-User-Id: aobEdbYhXfu5hkeqG" \ + -H "Content-type: application/json" \ + http://localhost:3000/api/v1/livechat/inquiries.take \ + -d '{ "inquiryId": "ByehQjC44FwMeiLbX" }' +``` + +## Example Result + +```json +{ + "inquiry": { + "_id": "wbKmn6pAZ8jyJuANG", + "rid": "S4wwL9WNY98uoHgJg", + "message": "test", + "name": "teste", + "ts": "2019-06-10T23:09:06.482Z", + "agents": [ + "hjwGZafNqExtFNmN7", + "26KdXgrQXhddy2MfQ" + ], + "status": "open", + "v": { + "_id": "2iZSexGXjW7EJnRwM", + "username": "guest-3", + "token": "RtQzkfQYKG4WpNMEW", + "status": "online" + }, + "t": "l", + "_updatedAt": "2019-06-10T23:09:07.480Z" + }, + "success": true +} +``` + +## Change Log + +| Version | Description | +| :--- | :--- | +| 1.2.0 | Added |