Canned Answers API
Canned Answers¶
Canned answers are organization wide chat messages which can be made beforehand or at the moment. They track the usage count of whole organization, user and in room.
A canned answer resource has the following attributes.
Attribute | Type | Editable | Description |
---|---|---|---|
id |
UUID | read-only | UUID string identifier |
organization_id |
UUID | read-only | The UUID of the owner organization. |
message |
string | required | The answer in string format. |
organization_count |
integer | read-only | Answer usage count by whole organization. |
room_count |
integer | read-only | Answer usage count in current room. |
created_at |
datetime | read-only | When the answer was created. |
updated_at |
datetime | read-only | When the answer updated last time. |
List user's canned answers at a room¶
GET /api/v5/users/<user_id>/rooms/<room_id>/canned_answers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
This API endpoint returns a paginated collection of canned answers. They are sorted by the creation time of the canned answers, in ascending order.
This endpoint takes the following optional GET parameters:
Parameter | Type | Default | Description |
---|---|---|---|
ordering |
ordering | created_at |
Ordering of results with options created_at , updated_at , organization_count (ascending). All options work also in descending ordering with line before option e.g. -created_at |
This endpoint returns:
- 200 if the request was successful
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the user
- 403 if you do not have access to the room
- 404 if the room was not found
Create a new canned answer¶
POST /api/v5/users/<user_id>/rooms/<room_id>/canned_answers
The userĀ“s organization will be set as the organization_id
.
1 2 3 |
|
This endpoint returns:
- 200 if the request was successful
- 400 if required attribute is missing from the request
- 400 if the request payload is in wrong format
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the user
- 403 if you do not have access to the room
- 404 if the room was not found
Retrieve a single canned answer¶
You can to retrieve a canned answer's details.
GET /api/v5/users/<user_id>/rooms/<room_id>/canned_answers/<canned_answer_id>
This endpoint returns:
- 200 if the request was successful
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the user
- 403 if you do not have access to the room
- 404 if the room was not found
- 404 if the canned answer was not found
Update a canned answer¶
You may update the message
attribute of a canned answer.
PUT /api/v5/users/<user_id>/rooms/<room_id>/canned_answers/<canned_answer_id>
PATCH /api/v5/users/<user_id>/rooms/<room_id>/canned_answers/<canned_answer_id>
This endpoint returns:
- 200 if the request was successful
- 400 if required attribute is missing from the request
- 400 if the request payload is in wrong format
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the user
- 403 if you do not have access to the room
- 404 if the room was not found
- 404 if the canned answer was not found
Delete a canned answer¶
You may delete the canned answer. It will be deleted from the owner organization.
DELETE /api/v5/users/<user_id>/rooms/<room_id>/canned_answers/<canned_answer_id>
This endpoint returns:
- 204 if the request was successful
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the user
- 403 if you do not have access to the room
- 404 if the room was not found
- 404 if the canned answer was not found
Increment the canned answer counter¶
Request to this endpoint will increment counters (organization, user, room) of canned answer by one.
POST /api/v5/users/<user_id>/rooms/<room_id>/canned_answers/<canned_answer_id>/increment
This endpoint returns:
- 200 if the request was successful
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the user
- 403 if you do not have access to the room
- 404 if the room was not found
- 404 if the canned answer was not found