From dc9e19a1228d0f134f7b57e2178f1417dfb04ddc Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Thu, 15 May 2025 15:30:40 +0700 Subject: [PATCH] update portal payload for developer docs --- .../definitions/resource/portal_single.yml | 6 + .../application/automation_rule/show.yml | 20 ++ swagger/paths/application/portal/index.yml | 43 ++++- swagger/paths/application/portal/show.yml | 79 ++++++++ swagger/paths/application/portal/update.yml | 61 ++++++- swagger/swagger.json | 171 +++++++++++++++++- 6 files changed, 369 insertions(+), 11 deletions(-) create mode 100644 swagger/definitions/resource/portal_single.yml create mode 100644 swagger/paths/application/portal/show.yml diff --git a/swagger/definitions/resource/portal_single.yml b/swagger/definitions/resource/portal_single.yml new file mode 100644 index 000000000..233b69f72 --- /dev/null +++ b/swagger/definitions/resource/portal_single.yml @@ -0,0 +1,6 @@ +type: object +properties: + payload: + type: object + description: A single portal object (for show/update endpoints) + $ref: '#/components/schemas/portal_item' \ No newline at end of file diff --git a/swagger/paths/application/automation_rule/show.yml b/swagger/paths/application/automation_rule/show.yml index cd53ef478..ea3db048b 100644 --- a/swagger/paths/application/automation_rule/show.yml +++ b/swagger/paths/application/automation_rule/show.yml @@ -19,6 +19,26 @@ responses: application/json: schema: $ref: '#/components/schemas/automation_rule' + example: + payload: + id: 90 + account_id: 1 + name: "add-label-bug-if-message-contains-bug" + description: "add-label-bug-if-message-contains-bug" + event_name: "message_created" + conditions: + - values: ["incoming"] + attribute_key: "message_type" + query_operator: "and" + filter_operator: "equal_to" + - values: ["bug"] + attribute_key: "content" + filter_operator: "contains" + actions: + - action_name: "add_label" + action_params: ["bugs", "support-query"] + created_on: 1650555440 + active: true '401': description: Unauthorized content: diff --git a/swagger/paths/application/portal/index.yml b/swagger/paths/application/portal/index.yml index 5cafe09e5..1c57fc7fb 100644 --- a/swagger/paths/application/portal/index.yml +++ b/swagger/paths/application/portal/index.yml @@ -13,10 +13,45 @@ responses: content: application/json: schema: - type: array - description: Array of all portals - items: - $ref: '#/components/schemas/portal' + $ref: '#/components/schemas/portal' + example: + payload: + - id: 4 + color: "#1F93FF" + custom_domain: "chatwoot.help" + header_text: "Handbook" + homepage_link: "https://www.chatwoot.com" + name: "Handbook" + page_title: "Handbook" + slug: "handbook" + archived: false + account_id: 1 + config: + allowed_locales: + - code: "en" + articles_count: 32 + categories_count: 9 + inbox: + id: 37 + avatar_url: "https://example.com/avatar.png" + channel_id: 1 + name: "Chatwoot" + channel_type: "Channel::WebWidget" + greeting_enabled: true + widget_color: "#1F93FF" + website_url: "chatwoot.com" + logo: + id: 19399916 + portal_id: 4 + file_type: "image/png" + account_id: 1 + file_url: "https://example.com/logo.png" + blob_id: 21239614 + filename: "square.png" + meta: + all_articles_count: 0 + categories_count: 9 + default_locale: "en" '403': description: Access denied content: diff --git a/swagger/paths/application/portal/show.yml b/swagger/paths/application/portal/show.yml new file mode 100644 index 000000000..20eb7e1f1 --- /dev/null +++ b/swagger/paths/application/portal/show.yml @@ -0,0 +1,79 @@ +tags: + - Help Center +operationId: get-details-of-a-single-portal +summary: Get a portal details +description: Get the details of a portal in the account +security: + - userApiKey: [] +parameters: + - $ref: '#/components/parameters/account_id' + - $ref: '#/components/parameters/portal_id' +responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/portal_single' + example: + payload: + id: 123 + archived: false + color: "#1F93FF" + config: + allowed_locales: + - code: "en" + articles_count: 32 + categories_count: 9 + custom_domain: "chatwoot.help" + header_text: "Handbook" + homepage_link: "https://www.chatwoot.com" + name: "Handbook" + slug: "handbook" + page_title: "Handbook" + account_id: 123 + inbox: + id: 123 + name: "Chatwoot" + website_url: "chatwoot.com" + channel_type: "Channel::WebWidget" + avatar_url: "https://example.com/avatar.png" + widget_color: "#1F93FF" + website_token: "4cWzuf9i9jxN9tbnv8K9STKU" + enable_auto_assignment: true + web_widget_script: "" + welcome_title: "Hi there ! 🙌🏼" + welcome_tagline: "We make it simple to connect with us." + greeting_enabled: true + greeting_message: "Hey there 👋, Thank you for reaching out to us." + channel_id: 123 + working_hours_enabled: true + enable_email_collect: true + csat_survey_enabled: true + timezone: "America/Los_Angeles" + business_name: "Chatwoot" + hmac_mandatory: true + logo: + id: 123 + portal_id: 123 + file_type: "image/png" + account_id: 123 + file_url: "https://example.com/logo.png" + blob_id: 123 + filename: "square.png" + meta: + all_articles_count: 32 + categories_count: 9 + default_locale: "en" + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/bad_request_error' + '404': + description: The given portal ID does not exist in the account + content: + application/json: + schema: + $ref: '#/components/schemas/bad_request_error' \ No newline at end of file diff --git a/swagger/paths/application/portal/update.yml b/swagger/paths/application/portal/update.yml index 5faa170cc..0679a37d0 100644 --- a/swagger/paths/application/portal/update.yml +++ b/swagger/paths/application/portal/update.yml @@ -5,6 +5,9 @@ summary: Update a portal description: Update a portal to account security: - userApiKey: [] +parameters: + - $ref: '#/components/parameters/account_id' + - $ref: '#/components/parameters/portal_id' requestBody: required: true content: @@ -17,10 +20,66 @@ responses: content: application/json: schema: - $ref: '#/components/schemas/portal' + $ref: '#/components/schemas/portal_single' + example: + payload: + id: 123 + archived: false + color: "#1F93FF" + config: + allowed_locales: + - code: "en" + articles_count: 32 + categories_count: 9 + custom_domain: "chatwoot.help" + header_text: "Handbook" + homepage_link: "https://www.chatwoot.com" + name: "Handbook" + slug: "handbook" + page_title: "Handbook" + account_id: 123 + inbox: + id: 123 + name: "Chatwoot" + website_url: "chatwoot.com" + channel_type: "Channel::WebWidget" + avatar_url: "https://example.com/avatar.png" + widget_color: "#1F93FF" + website_token: "4cWzuf9i9jxN9tbnv8K9STKU" + enable_auto_assignment: true + web_widget_script: "" + welcome_title: "Hi there ! 🙌🏼" + welcome_tagline: "We make it simple to connect with us." + greeting_enabled: true + greeting_message: "Hey there 👋, Thank you for reaching out to us." + channel_id: 123 + working_hours_enabled: true + enable_email_collect: true + csat_survey_enabled: true + timezone: "America/Los_Angeles" + business_name: "Chatwoot" + hmac_mandatory: true + logo: + id: 123 + portal_id: 123 + file_type: "image/png" + account_id: 123 + file_url: "https://example.com/logo.png" + blob_id: 123 + filename: "square.png" + meta: + all_articles_count: 32 + categories_count: 9 + default_locale: "en" '403': description: Access denied content: application/json: schema: $ref: '#/components/schemas/bad_request_error' + '404': + description: Portal not found + content: + application/json: + schema: + $ref: '#/components/schemas/bad_request_error' diff --git a/swagger/swagger.json b/swagger/swagger.json index 0c35e0635..08d2838a0 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -3472,6 +3472,43 @@ "application/json": { "schema": { "$ref": "#/components/schemas/automation_rule" + }, + "example": { + "payload": { + "id": 90, + "account_id": 1, + "name": "add-label-bug-if-message-contains-bug", + "description": "add-label-bug-if-message-contains-bug", + "event_name": "message_created", + "conditions": [ + { + "values": [ + "incoming" + ], + "attribute_key": "message_type", + "query_operator": "and", + "filter_operator": "equal_to" + }, + { + "values": [ + "bug" + ], + "attribute_key": "content", + "filter_operator": "contains" + } + ], + "actions": [ + { + "action_name": "add_label", + "action_params": [ + "bugs", + "support-query" + ] + } + ], + "created_on": 1650555440, + "active": true + } } } } @@ -3696,11 +3733,56 @@ "content": { "application/json": { "schema": { - "type": "array", - "description": "Array of all portals", - "items": { - "$ref": "#/components/schemas/portal" - } + "$ref": "#/components/schemas/portal" + }, + "example": { + "payload": [ + { + "id": 4, + "color": "#1F93FF", + "custom_domain": "chatwoot.help", + "header_text": "Handbook", + "homepage_link": "https://www.chatwoot.com", + "name": "Handbook", + "page_title": "Handbook", + "slug": "handbook", + "archived": false, + "account_id": 1, + "config": { + "allowed_locales": [ + { + "code": "en", + "articles_count": 32, + "categories_count": 9 + } + ] + }, + "inbox": { + "id": 37, + "avatar_url": "https://example.com/avatar.png", + "channel_id": 1, + "name": "Chatwoot", + "channel_type": "Channel::WebWidget", + "greeting_enabled": true, + "widget_color": "#1F93FF", + "website_url": "chatwoot.com" + }, + "logo": { + "id": 19399916, + "portal_id": 4, + "file_type": "image/png", + "account_id": 1, + "file_url": "https://example.com/logo.png", + "blob_id": 21239614, + "filename": "square.png" + }, + "meta": { + "all_articles_count": 0, + "categories_count": 9, + "default_locale": "en" + } + } + ] } } } @@ -3741,6 +3823,14 @@ ] } ], + "parameters": [ + { + "$ref": "#/components/parameters/account_id" + }, + { + "$ref": "#/components/parameters/portal_id" + } + ], "requestBody": { "required": true, "content": { @@ -3757,7 +3847,66 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/portal" + "$ref": "#/components/schemas/portal_single" + }, + "example": { + "payload": { + "id": 123, + "archived": false, + "color": "#1F93FF", + "config": { + "allowed_locales": [ + { + "code": "en", + "articles_count": 32, + "categories_count": 9 + } + ] + }, + "custom_domain": "chatwoot.help", + "header_text": "Handbook", + "homepage_link": "https://www.chatwoot.com", + "name": "Handbook", + "slug": "handbook", + "page_title": "Handbook", + "account_id": 123, + "inbox": { + "id": 123, + "name": "Chatwoot", + "website_url": "chatwoot.com", + "channel_type": "Channel::WebWidget", + "avatar_url": "https://example.com/avatar.png", + "widget_color": "#1F93FF", + "website_token": "4cWzuf9i9jxN9tbnv8K9STKU", + "enable_auto_assignment": true, + "web_widget_script": "", + "welcome_title": "Hi there ! 🙌🏼", + "welcome_tagline": "We make it simple to connect with us.", + "greeting_enabled": true, + "greeting_message": "Hey there 👋, Thank you for reaching out to us.", + "channel_id": 123, + "working_hours_enabled": true, + "enable_email_collect": true, + "csat_survey_enabled": true, + "timezone": "America/Los_Angeles", + "business_name": "Chatwoot", + "hmac_mandatory": true + }, + "logo": { + "id": 123, + "portal_id": 123, + "file_type": "image/png", + "account_id": 123, + "file_url": "https://example.com/logo.png", + "blob_id": 123, + "filename": "square.png" + }, + "meta": { + "all_articles_count": 32, + "categories_count": 9, + "default_locale": "en" + } + } } } } @@ -3771,6 +3920,16 @@ } } } + }, + "404": { + "description": "Portal not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/bad_request_error" + } + } + } } } }