diff --git a/config/routes.rb b/config/routes.rb index 6e4296e62..3b6578b8c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -52,8 +52,8 @@ Rails.application.routes.draw do post :reauthorize_page end end - resources :canned_responses, except: [:show, :edit, :new] - resources :automation_rules, except: [:edit] do + resources :canned_responses, only: [:index, :create, :update, :destroy] + resources :automation_rules, only: [:index, :create, :show, :update, :destroy] do post :clone end resources :campaigns, only: [:index, :create, :show, :update, :destroy] @@ -145,7 +145,7 @@ Rails.application.routes.draw do resource :authorization, only: [:create] end - resources :webhooks, except: [:show] + resources :webhooks, only: [:index, :create, :update, :destroy] namespace :integrations do resources :apps, only: [:index, :show] resources :hooks, only: [:create, :update, :destroy] diff --git a/swagger/definitions/index.yml b/swagger/definitions/index.yml index fb24800de..7ee10e56d 100644 --- a/swagger/definitions/index.yml +++ b/swagger/definitions/index.yml @@ -12,6 +12,8 @@ request_error: generic_id: $ref: ./resource/extension/generic.yml +canned_response: + $ref: ./resource/canned_response.yml contact: $ref: ./resource/contact.yml conversation: @@ -64,6 +66,9 @@ agent_bot_create_update_payload: user_create_update_payload: $ref: ./request/user/create_update_payload.yml +canned_response_create_update_payload: + $ref: ./request/canned_response/create_update_payload.yml + ## contact contact_create: $ref: ./request/contact/create.yml diff --git a/swagger/definitions/request/canned_response/create_update_payload.yml b/swagger/definitions/request/canned_response/create_update_payload.yml new file mode 100644 index 000000000..ef6f7f74a --- /dev/null +++ b/swagger/definitions/request/canned_response/create_update_payload.yml @@ -0,0 +1,8 @@ +type: object +properties: + content: + type: string + description: Message content for canned response + short_code: + type: string + description: Short Code for quick access of the canned response diff --git a/swagger/definitions/resource/canned_response.yml b/swagger/definitions/resource/canned_response.yml new file mode 100644 index 000000000..b044b703a --- /dev/null +++ b/swagger/definitions/resource/canned_response.yml @@ -0,0 +1,14 @@ +type: object +properties: + id: + type: integer + description: ID of the canned response + content: + type: string + description: Message content for canned response + short_code: + type: string + description: Short Code for quick access of the canned response + account_id: + type: integer + description: Account Id diff --git a/swagger/index.yml b/swagger/index.yml index 2420658e3..28f20ce5a 100644 --- a/swagger/index.yml +++ b/swagger/index.yml @@ -54,6 +54,7 @@ x-tagGroups: tags: - Account AgentBots - Agent + - Canned Response - Contact - Conversation - Conversation Assignment diff --git a/swagger/paths/application/canned_responses/create.yml b/swagger/paths/application/canned_responses/create.yml new file mode 100644 index 000000000..69b3673bc --- /dev/null +++ b/swagger/paths/application/canned_responses/create.yml @@ -0,0 +1,21 @@ +tags: + - Canned Response +operationId: add-new-canned-response-to-account +summary: Add a New Canned Response +description: Add a new Canned Response to Account +security: + - userApiKey: [] +parameters: + - name: data + in: body + required: true + schema: + $ref: '#/definitions/canned_response_create_update_payload' +responses: + 200: + description: Success + schema: + description: 'Newly Created Canned Response' + $ref: '#/definitions/canned_response' + 403: + description: Access denied diff --git a/swagger/paths/application/canned_responses/delete.yml b/swagger/paths/application/canned_responses/delete.yml new file mode 100644 index 000000000..4b82e5068 --- /dev/null +++ b/swagger/paths/application/canned_responses/delete.yml @@ -0,0 +1,20 @@ +tags: + - Canned Response +operationId: delete-canned-response-from-account +summary: Remove a Canned Response from Account +description: Remove a Canned Response from Account +security: + - userApiKey: [] +parameters: + - in: path + name: id + type: integer + required: true + description: The ID of the canned response to be deleted +responses: + 200: + description: Success + 404: + description: Canned Response not found + 403: + description: Access denied diff --git a/swagger/paths/application/canned_responses/index.yml b/swagger/paths/application/canned_responses/index.yml new file mode 100644 index 000000000..4e4a24c5d --- /dev/null +++ b/swagger/paths/application/canned_responses/index.yml @@ -0,0 +1,17 @@ +tags: + - Canned Response +operationId: get-account-canned-response +summary: List all Canned Responses in an Account +description: Get Details of Canned Responses in an Account +security: + - userApiKey: [] +responses: + 200: + description: Success + schema: + type: array + description: 'Array of all canned responses' + items: + $ref: '#/definitions/canned_response' + 403: + description: Access denied diff --git a/swagger/paths/application/canned_responses/update.yml b/swagger/paths/application/canned_responses/update.yml new file mode 100644 index 000000000..7ea801f2f --- /dev/null +++ b/swagger/paths/application/canned_responses/update.yml @@ -0,0 +1,28 @@ +tags: + - Canned Response +operationId: update-canned-response-in-account +summary: Update Canned Response in Account +description: Update a Canned Response in Account +security: + - userApiKey: [] +parameters: + - in: path + name: id + type: integer + required: true + description: The ID of the canned response to be updated. + - name: data + in: body + required: true + schema: + $ref: '#/definitions/canned_response_create_update_payload' +responses: + 200: + description: Success + schema: + description: 'The updated canned response' + $ref: '#/definitions/canned_response' + 404: + description: Agent not found + 403: + description: Access denied diff --git a/swagger/paths/index.yml b/swagger/paths/index.yml index 8a4154bb8..ec2fcc38b 100644 --- a/swagger/paths/index.yml +++ b/swagger/paths/index.yml @@ -154,6 +154,21 @@ delete: $ref: ./application/agents/delete.yml +# Agents +/api/v1/accounts/{account_id}/canned_responses: + parameters: + - $ref: '#/parameters/account_id' + get: + $ref: ./application/canned_responses/index.yml + post: + $ref: ./application/canned_responses/create.yml +/api/v1/accounts/{account_id}/canned_responses/{id}: + parameters: + - $ref: '#/parameters/account_id' + patch: + $ref: ./application/canned_responses/update.yml + delete: + $ref: ./application/canned_responses/delete.yml # Contacts /api/v1/accounts/{account_id}/contacts: diff --git a/swagger/swagger.json b/swagger/swagger.json index 8e574fedc..1fdcd4785 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -1333,6 +1333,167 @@ } } }, + "/api/v1/accounts/{account_id}/canned_responses": { + "parameters": [ + { + "$ref": "#/parameters/account_id" + } + ], + "get": { + "tags": [ + "Canned Response" + ], + "operationId": "get-account-canned-response", + "summary": "List all Canned Responses in an Account", + "description": "Get Details of Canned Responses in an Account", + "security": [ + { + "userApiKey": [ + + ] + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "array", + "description": "Array of all canned responses", + "items": { + "$ref": "#/definitions/canned_response" + } + } + }, + "403": { + "description": "Access denied" + } + } + }, + "post": { + "tags": [ + "Canned Response" + ], + "operationId": "add-new-canned-response-to-account", + "summary": "Add a New Canned Response", + "description": "Add a new Canned Response to Account", + "security": [ + { + "userApiKey": [ + + ] + } + ], + "parameters": [ + { + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/canned_response_create_update_payload" + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/canned_response" + } + }, + "403": { + "description": "Access denied" + } + } + } + }, + "/api/v1/accounts/{account_id}/canned_responses/{id}": { + "parameters": [ + { + "$ref": "#/parameters/account_id" + } + ], + "patch": { + "tags": [ + "Canned Response" + ], + "operationId": "update-canned-response-in-account", + "summary": "Update Canned Response in Account", + "description": "Update a Canned Response in Account", + "security": [ + { + "userApiKey": [ + + ] + } + ], + "parameters": [ + { + "in": "path", + "name": "id", + "type": "integer", + "required": true, + "description": "The ID of the canned response to be updated." + }, + { + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/canned_response_create_update_payload" + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/canned_response" + } + }, + "404": { + "description": "Agent not found" + }, + "403": { + "description": "Access denied" + } + } + }, + "delete": { + "tags": [ + "Canned Response" + ], + "operationId": "delete-canned-response-from-account", + "summary": "Remove a Canned Response from Account", + "description": "Remove a Canned Response from Account", + "security": [ + { + "userApiKey": [ + + ] + } + ], + "parameters": [ + { + "in": "path", + "name": "id", + "type": "integer", + "required": true, + "description": "The ID of the canned response to be deleted" + } + ], + "responses": { + "200": { + "description": "Success" + }, + "404": { + "description": "Canned Response not found" + }, + "403": { + "description": "Access denied" + } + } + } + }, "/api/v1/accounts/{account_id}/contacts": { "get": { "tags": [ @@ -3549,6 +3710,27 @@ } } }, + "canned_response": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "ID of the canned response" + }, + "content": { + "type": "string", + "description": "Message content for canned response" + }, + "short_code": { + "type": "string", + "description": "Short Code for quick access of the canned response" + }, + "account_id": { + "type": "integer", + "description": "Account Id" + } + } + }, "contact": { "type": "object", "properties": { @@ -4196,6 +4378,19 @@ } } }, + "canned_response_create_update_payload": { + "type": "object", + "properties": { + "content": { + "type": "string", + "description": "Message content for canned response" + }, + "short_code": { + "type": "string", + "description": "Short Code for quick access of the canned response" + } + } + }, "contact_create": { "type": "object", "required": [ @@ -4894,6 +5089,7 @@ "tags": [ "Account AgentBots", "Agent", + "Canned Response", "Contact", "Conversation", "Conversation Assignment",