mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-29 18:22:53 +00:00
chore: API documentation updates for CSAT surveys (#7255)
- Expose conversation uuid in APIs - swagger documentation for cast survey update via public/message/update endpoints - swagger documentation for survey/responses/conversation_uuid endpoint Fixes: #6328
This commit is contained in:
@@ -26,6 +26,7 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
json.account_id conversation.account_id
|
json.account_id conversation.account_id
|
||||||
|
json.uuid conversation.uuid
|
||||||
json.additional_attributes conversation.additional_attributes
|
json.additional_attributes conversation.additional_attributes
|
||||||
json.agent_last_seen_at conversation.agent_last_seen_at.to_i
|
json.agent_last_seen_at conversation.agent_last_seen_at.to_i
|
||||||
json.assignee_last_seen_at conversation.assignee_last_seen_at.to_i
|
json.assignee_last_seen_at conversation.assignee_last_seen_at.to_i
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
json.id conversation.display_id
|
json.id conversation.display_id
|
||||||
|
json.uuid conversation.uuid
|
||||||
json.created_at conversation.created_at.to_i
|
json.created_at conversation.created_at.to_i
|
||||||
json.contact do
|
json.contact do
|
||||||
json.id conversation.contact.id
|
json.id conversation.contact.id
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
json.id resource.display_id
|
json.id resource.display_id
|
||||||
|
json.uuid resource.uuid
|
||||||
json.inbox_id resource.inbox_id
|
json.inbox_id resource.inbox_id
|
||||||
json.contact_last_seen_at resource.contact_last_seen_at.to_i
|
json.contact_last_seen_at resource.contact_last_seen_at.to_i
|
||||||
json.status resource.status
|
json.status resource.status
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ RSpec.describe 'Conversations API', type: :request do
|
|||||||
body = JSON.parse(response.body, symbolize_names: true)
|
body = JSON.parse(response.body, symbolize_names: true)
|
||||||
expect(body[:data][:meta][:all_count]).to eq(1)
|
expect(body[:data][:meta][:all_count]).to eq(1)
|
||||||
expect(body[:data][:meta].keys).to include(:all_count, :mine_count, :assigned_count, :unassigned_count)
|
expect(body[:data][:meta].keys).to include(:all_count, :mine_count, :assigned_count, :unassigned_count)
|
||||||
|
expect(body[:data][:payload].first[:uuid]).to eq(conversation.uuid)
|
||||||
expect(body[:data][:payload].first[:messages].first[:id]).to eq(message.id)
|
expect(body[:data][:payload].first[:messages].first[:id]).to eq(message.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ RSpec.describe 'Public Inbox Contact Conversations API', type: :request do
|
|||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
data = response.parsed_body
|
data = response.parsed_body
|
||||||
expect(data.length).to eq 1
|
expect(data.length).to eq 1
|
||||||
|
expect(data.first['uuid']).to eq contact_inbox.conversations.first.uuid
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not return any private or activity message' do
|
it 'does not return any private or activity message' do
|
||||||
|
|||||||
@@ -2,7 +2,19 @@
|
|||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
submitted_values:
|
submitted_values:
|
||||||
type: object
|
oneOf:
|
||||||
description: Replies to the Bot Message Types
|
- type: object
|
||||||
|
description: Replies to the Bot Message Types
|
||||||
|
properties:
|
||||||
|
csat_survey_response:
|
||||||
|
type: object
|
||||||
|
description: CSAT Survey Response if original message is CSAT Survey
|
||||||
|
properties:
|
||||||
|
rating:
|
||||||
|
type: integer
|
||||||
|
description: CSAT Rating
|
||||||
|
example: 5
|
||||||
|
feedback_message:
|
||||||
|
type: string
|
||||||
|
description: CSAT Comment
|
||||||
|
example: 'Great'
|
||||||
|
|||||||
@@ -75,3 +75,6 @@ x-tagGroups:
|
|||||||
- Contacts API
|
- Contacts API
|
||||||
- Conversations API
|
- Conversations API
|
||||||
- Messages API
|
- Messages API
|
||||||
|
- name: Others
|
||||||
|
tags:
|
||||||
|
- CSAT Survey Page
|
||||||
5
swagger/parameters/conversation_uuid.yml
Normal file
5
swagger/parameters/conversation_uuid.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
in: path
|
||||||
|
name: conversation_uuid
|
||||||
|
type: integer
|
||||||
|
required: true
|
||||||
|
description: The uuid of the conversation
|
||||||
@@ -22,6 +22,9 @@ contact_sort_param:
|
|||||||
conversation_id:
|
conversation_id:
|
||||||
$ref: ./conversation_id.yml
|
$ref: ./conversation_id.yml
|
||||||
|
|
||||||
|
conversation_uuid:
|
||||||
|
$ref: ./conversation_uuid.yml
|
||||||
|
|
||||||
custom_filter_id:
|
custom_filter_id:
|
||||||
$ref: ./custom_filter_id.yml
|
$ref: ./custom_filter_id.yml
|
||||||
|
|
||||||
|
|||||||
@@ -124,6 +124,16 @@
|
|||||||
|
|
||||||
# ---------------- end of public api routes-----------#
|
# ---------------- end of public api routes-----------#
|
||||||
|
|
||||||
|
# ------------ Other routes ------------#
|
||||||
|
|
||||||
|
/survey/responses/{conversation_uuid}:
|
||||||
|
parameters:
|
||||||
|
- $ref: '#/parameters/conversation_uuid'
|
||||||
|
get:
|
||||||
|
$ref: ./survey/show.yml
|
||||||
|
|
||||||
|
# ----------- end of other routes -----------#
|
||||||
|
|
||||||
# ------------ Application API routes ------------#
|
# ------------ Application API routes ------------#
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
9
swagger/paths/survey/show.yml
Normal file
9
swagger/paths/survey/show.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
tags:
|
||||||
|
- CSAT Survey Page
|
||||||
|
operationId: get-csat-survey-page
|
||||||
|
summary: Get CSAT survey page
|
||||||
|
description: You can redirect the client to this URL, instead of implementing the CSAT survey component yourself.
|
||||||
|
security: []
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: Success
|
||||||
@@ -1000,6 +1000,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/survey/responses/{conversation_uuid}": {
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"$ref": "#/parameters/conversation_uuid"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"CSAT Survey Page"
|
||||||
|
],
|
||||||
|
"operationId": "get-csat-survey-page",
|
||||||
|
"summary": "Get CSAT survey page",
|
||||||
|
"description": "You can redirect the client to this URL, instead of implementing the CSAT survey component yourself.",
|
||||||
|
"security": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Success"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/v1/accounts/{account_id}/agent_bots": {
|
"/api/v1/accounts/{account_id}/agent_bots": {
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -6567,8 +6590,30 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"submitted_values": {
|
"submitted_values": {
|
||||||
"type": "object",
|
"oneOf": [
|
||||||
"description": "Replies to the Bot Message Types"
|
{
|
||||||
|
"type": "object",
|
||||||
|
"description": "Replies to the Bot Message Types",
|
||||||
|
"properties": {
|
||||||
|
"csat_survey_response": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "CSAT Survey Response if original message is CSAT Survey",
|
||||||
|
"properties": {
|
||||||
|
"rating": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "CSAT Rating",
|
||||||
|
"example": 5
|
||||||
|
},
|
||||||
|
"feedback_message": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "CSAT Comment",
|
||||||
|
"example": "Great"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -6973,6 +7018,13 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"description": "The numeric ID of the conversation"
|
"description": "The numeric ID of the conversation"
|
||||||
},
|
},
|
||||||
|
"conversation_uuid": {
|
||||||
|
"in": "path",
|
||||||
|
"name": "conversation_uuid",
|
||||||
|
"type": "integer",
|
||||||
|
"required": true,
|
||||||
|
"description": "The uuid of the conversation"
|
||||||
|
},
|
||||||
"custom_filter_id": {
|
"custom_filter_id": {
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"name": "custom_filter_id",
|
"name": "custom_filter_id",
|
||||||
@@ -7093,6 +7145,12 @@
|
|||||||
"Conversations API",
|
"Conversations API",
|
||||||
"Messages API"
|
"Messages API"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Others",
|
||||||
|
"tags": [
|
||||||
|
"CSAT Survey Page"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user