Skip to content

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
{
  "next": "https://service.giosg.com/api/v5/users/7f9e9580-095b-42c7-838c-c04e667b26f7/rooms/9926bdfa-56e0-11e5-b98c-6c4008c08dfe/canned_answers?cursor=171cfd0d7ce542be86221f01d2823cb1",
  "previous": null,
  "results": [
    {
      "id": "58f5055c-56e0-11e5-9354-6c4008c08dfe",
      "organization_id": "398b5138-3224-11e6-987e-f45c89c72de3",
      "message": "How can I help you?",
      "organization_count": 5,
      "room_count": 1,
      "created_at": "2015-02-13T11:31:36.042",
      "updated_at": "2015-02-13T12:38:36.431"
    }
  ]
}

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
{
  "message": "An example canned answer"
}

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