From a2e72213c4c556ce6144710584c4ab84ec3c752f Mon Sep 17 00:00:00 2001 From: menachem mendel kuperman Date: Tue, 22 Sep 2026 20:16:52 +0300 Subject: [PATCH] fix(chat): apply maximum message deletion scope --- .github/workflows/check_code_quality.yml | 3 + docs/delete-message.md | 117 +- docs/runtime-routes.json | 11215 +++++++++++++++- package-lock.json | 4 +- package.json | 3 +- scripts/audit-runtime-openapi.mjs | 7 + scripts/runtime-openapi-conventions.mjs | 20 +- scripts/runtime-openapi-overrides.mjs | 17 +- src/api/abstract/abstract.router.ts | 3 +- src/api/dto/chat.dto.ts | 5 +- .../whatsapp/whatsapp.baileys.service.ts | 211 +- src/api/services/message-key.service.ts | 29 + src/utils/coerceFormBody.ts | 46 + src/validate/chat.schema.ts | 25 +- test/message-key.test.ts | 52 +- 15 files changed, 11354 insertions(+), 403 deletions(-) create mode 100644 src/utils/coerceFormBody.ts diff --git a/.github/workflows/check_code_quality.yml b/.github/workflows/check_code_quality.yml index bd8c0417ef..a73a4101d6 100644 --- a/.github/workflows/check_code_quality.yml +++ b/.github/workflows/check_code_quality.yml @@ -63,6 +63,9 @@ jobs: - name: Check generated runtime OpenAPI contracts run: npm run audit:runtime-openapi + - name: Test automatic message deletion and guided forms + run: npm run test:delete-message + - name: Check chat and Baileys API documentation run: npm run audit:chat-docs && npm run audit:baileys-docs diff --git a/docs/delete-message.md b/docs/delete-message.md index 4504c1f7a7..8add91d846 100644 --- a/docs/delete-message.md +++ b/docs/delete-message.md @@ -1,80 +1,99 @@ -# Delete a message for everyone +# Delete a message -Use `DELETE /chat/deleteMessageForEveryone/{instanceName}` to revoke a message from WhatsApp. The route detects whether the original message belongs to the connected account or to another group participant, chooses the strongest valid WhatsApp revoke mode, and waits for a server acknowledgement before reporting success. +Use `DELETE /chat/deleteMessageForEveryone/{instanceName}` to delete one WhatsApp message with the strongest permission available. The route name is retained for compatibility, but callers do not choose the scope: -## Ownership detection +1. A message sent by the connected account is deleted for everyone. +2. Another participant's group message is deleted for everyone when the connected account is a group admin. +3. Another person's direct message is deleted for the connected account only. +4. Another participant's group message is deleted for the connected account only when the account is not a group admin. +5. If a delete-for-everyone submission is not confirmed, the route falls back to delete-for-me. -The API resolves the operation in this order: +The response always states the applied `deletion.scope`. `EVERYONE` means WhatsApp acknowledged the revoke. `ME` means WhatsApp accepted the app-state patch used to remove the message from the connected account and its linked devices. -1. If the original message exists in the instance-scoped `Message` table, its stored `key.fromMe`, chat JID, and participant JID are authoritative. -2. Otherwise, an explicit `fromMe` value is used as a compatibility override. -3. Otherwise, a group request with `participant` is treated as another participant's message and uses group-admin deletion. -4. Otherwise, the message is treated as one sent by the connected account. +## Request fields -The response reports the selected `deletion.target` and `deletion.ownershipSource`. Clients normally should omit `fromMe` and let the API detect the correct mode. +| Field | Required | Meaning | +| --- | --- | --- | +| `id` | Yes | Original `data.key.id`. | +| `remoteJid` | Yes | Original `data.key.remoteJid`. For groups this is the **group JID**, never the participant JID. | +| `participant` | Recommended for groups | Original `data.key.participant`, commonly an LID. | +| `participantAlt` | Optional | Original `data.key.participantAlt`, commonly the phone-number JID. | +| `messageTimestamp` | Fallback | Original `data.messageTimestamp` in Unix seconds. It is required for delete-for-me only when Evolution cannot find the stored message. | +| `deleteMedia` | No | Whether delete-for-me also removes locally stored media. Defaults to `true`. | +| `fromMe` | Compatibility only | Normally omit it. The archived message key remains authoritative. | -## Permissions and limitations - -- A message sent by the connected account can be revoked in a direct chat or group, subject to WhatsApp's deletion window and server policy. -- Another participant's group message can be revoked only when the connected account is a group admin. The original participant JID is required. -- WhatsApp does not permit revoking another person's incoming direct message for everyone. The API returns `CANNOT_REVOKE_INCOMING_DIRECT_MESSAGE` instead of a misleading pending success. -- The API cannot elevate a non-admin account. When group metadata identifies the connected account as a non-admin, the request returns `GROUP_ADMIN_REQUIRED`. - -## Recommended request - -When message storage is enabled, only the message ID and chat JID are needed: - -```http -DELETE /chat/deleteMessageForEveryone/chabad-info -apikey: YOUR_GLOBAL_API_KEY -Content-Type: application/json +Example for a group message: +```json { - "id": "3A222167F7B463F69944", - "remoteJid": "120363043342036080@g.us" + "id": "3EB0154DD79F8A3DFF054D", + "remoteJid": "120363410369941696@g.us", + "participant": "151672961659093@lid", + "participantAlt": "972553049308@s.whatsapp.net", + "messageTimestamp": 1790062631, + "deleteMedia": true } ``` -When the original message is not stored, copy the participant identities from the `MESSAGES_UPSERT` webhook key: +Do not put `participant`, `participantAlt`, the Evolution database row ID, or the webhook envelope's `sender` in `remoteJid`. + +## Response: deleted for everyone ```json { - "id": "3A222167F7B463F69944", - "remoteJid": "120363043342036080@g.us", - "participant": "184353602666626@lid", - "participantAlt": "972559128260@s.whatsapp.net" + "status": 2, + "deletion": { + "requestedMessageId": "3EB0154DD79F8A3DFF054D", + "scope": "EVERYONE", + "target": "OTHER_PARTICIPANT_MESSAGE", + "ownershipSource": "ARCHIVED_MESSAGE_KEY", + "submitted": true, + "appStatePatchAccepted": false, + "serverAcknowledged": true, + "everyoneAttempted": true, + "everyoneConfirmed": true, + "status": "SERVER_ACK" + } } ``` -`participantAlt` helps identity resolution, but the WhatsApp revoke protobuf itself contains only `remoteJid`, `fromMe`, `id`, and `participant`. This is why retaining extra LID metadata alone did not fix incomplete revoke keys in earlier releases. - -## Confirmed response - -The route no longer treats Baileys's immediate `PENDING` object as proof of deletion. It listens for the outgoing revoke message's WhatsApp server acknowledgement. Only then does it update the local message state, emit `MESSAGES_DELETE`, and return success: +## Response: deleted for me ```json { - "status": "SERVER_ACK", + "status": "APP_STATE_PATCH_ACCEPTED", "deletion": { - "requestedMessageId": "3A222167F7B463F69944", - "target": "GROUP_PARTICIPANT_MESSAGE", + "requestedMessageId": "3EB0154DD79F8A3DFF054D", + "scope": "ME", + "target": "OTHER_PARTICIPANT_MESSAGE", "ownershipSource": "ARCHIVED_MESSAGE_KEY", + "fallbackReason": "INCOMING_DIRECT_MESSAGE", "submitted": true, - "serverAcknowledged": true, - "status": "SERVER_ACK" + "appStatePatchAccepted": true, + "serverAcknowledged": false, + "everyoneAttempted": false, + "everyoneConfirmed": false, + "status": "APP_STATE_PATCH_ACCEPTED" } } ``` -If no acknowledgement arrives within ten seconds, the API returns `DELETE_NOT_ACKNOWLEDGED` and does not mark the local message as deleted. +Possible fallback reasons are `INCOMING_DIRECT_MESSAGE`, `GROUP_ADMIN_REQUIRED`, `GROUP_PARTICIPANT_REQUIRED`, and `EVERYONE_NOT_CONFIRMED`. + +Delete-for-me uses Baileys `chatModify({ deleteForMe })`. Unlike a revoke, this app-state operation does not create an outgoing protocol message with a message-status acknowledgement. The API therefore reports `appStatePatchAccepted` separately instead of pretending it received `SERVER_ACK`. + +## n8n mapping + +When an n8n Webhook node provides the standard `body` wrapper, use: -## n8n node +- **Chat JID (Contact or Group)**: `{{ $json.body.data.key.remoteJid }}` +- **Message ID**: `{{ $json.body.data.key.id }}` +- **Original Participant JID**: `{{ $json.body.data.key.participant }}` +- **Participant Alternate JID**: `{{ $json.body.data.key.participantAlt }}` +- **Message Timestamp**: `{{ $json.body.data.messageTimestamp }}` -In `n8n-nodes-evolution-api-en` 4.3.1 or newer, choose **Auto Detect** for **Message Ownership**. For a group message, map these webhook values when available: +If a previous node has already unwrapped `body`, remove `.body` from those expressions. -- **Contact**: `{{$json.data.key.remoteJid}}` -- **Message ID**: `{{$json.data.key.id}}` -- **Original Participant JID**: `{{$json.data.key.participant}}` -- **Participant Alternate JID**: `{{$json.data.key.participantAlt}}` +## Swagger -The node throws an error for an unconfirmed `PENDING` response instead of returning `success: true`. +Swagger presents the request schema as individual guided fields through `application/x-www-form-urlencoded`. Select `application/json` from the request content-type menu only when you want the advanced raw JSON editor. Both modes use the same validation schema. diff --git a/docs/runtime-routes.json b/docs/runtime-routes.json index 8f42649974..8bceaf318a 100644 --- a/docs/runtime-routes.json +++ b/docs/runtime-routes.json @@ -286,7 +286,22 @@ "x-source": "src/api/routes/archive.router.ts", "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": { + "limit": { + "type": "integer", + "minimum": 1, + "maximum": 100000 + } + }, + "required": [] + } + }, "application/json": { "schema": { "type": "object", @@ -3863,7 +3878,44 @@ "x-source": "src/api/routes/archive.router.ts", "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string" + }, + "scope": { + "type": "string", + "enum": [ + "general", + "entity", + "account", + "jid" + ] + }, + "selector": { + "type": "object", + "additionalProperties": true + }, + "policy": { + "type": "object", + "additionalProperties": true + }, + "effectiveAt": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "scope", + "policy" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -4182,7 +4234,26 @@ "x-source": "src/api/routes/archive.router.ts", "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": { + "previewId": { + "type": "string" + }, + "confirmationToken": { + "type": "string" + } + }, + "required": [ + "previewId", + "confirmationToken" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -4492,7 +4563,36 @@ "x-source": "src/api/routes/archive.router.ts", "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": { + "before": { + "type": "string", + "format": "date-time" + }, + "entityJid": { + "type": "string" + }, + "groupJid": { + "type": "string" + }, + "eventTypes": { + "type": "array", + "items": { + "type": "string" + } + }, + "mediaOnly": { + "type": "boolean" + } + }, + "required": [] + } + }, "application/json": { "schema": { "type": "object", @@ -6324,7 +6424,16 @@ "x-source": "src/api/routes/archive.router.ts", "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": {}, + "required": [] + } + }, "application/json": { "schema": { "type": "object", @@ -6626,7 +6735,21 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string" + }, + "limit": { + "type": "number" + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -6935,7 +7058,21 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string" + }, + "limit": { + "type": "number" + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -7263,7 +7400,40 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string", + "pattern": "^(?!@[^@\\s]+$).+", + "description": "Use a phone number or full WhatsApp JID. A raw @username must first be resolved to an authoritative @lid JID." + }, + "settingsTemplateId": { + "type": "string", + "minLength": 1 + }, + "isVideo": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "callDuration": { + "type": "integer", + "minimum": 1, + "maximum": 15 + } + }, + "required": [ + "number", + "callDuration" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -7668,7 +7838,98 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "chat": { + "type": "string" + }, + "lastMessage": { + "type": "object", + "properties": { + "key": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "remoteJid": { + "type": "string" + }, + "fromMe": { + "type": "boolean", + "enum": [ + true, + false + ] + } + }, + "required": [ + "id", + "fromMe", + "remoteJid" + ], + "if": { + "propertyNames": { + "enum": [ + "id", + "remoteJid" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + }, + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + } + } + } + }, + "messageTimestamp": { + "type": "integer", + "minLength": 1 + } + }, + "required": [ + "key" + ], + "if": { + "propertyNames": { + "enum": [ + "messageTimestamp" + ] + } + }, + "then": { + "properties": { + "messageTimestamp": { + "minLength": 1, + "description": "The \"messageTimestamp\" cannot be empty" + } + } + } + }, + "archive": { + "type": "boolean", + "enum": [ + true, + false + ] + } + }, + "required": [ + "archive" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -7776,36 +8037,28 @@ "id": { "type": "string" }, - "fromMe": { - "type": "boolean", - "enum": [ - true, - false - ], - "description": "Optional ownership override. Omit it to detect ownership from the archived original message. True means the connected account sent it; false selects admin deletion for another participant’s group message." - }, "remoteJid": { "type": "string", "pattern": "^(?:\\d+@(?:s\\.whatsapp\\.net|lid)|\\d+-\\d+@g\\.us|status@broadcast|[^@\\s]+@broadcast)$", - "description": "remoteJid must be a full WhatsApp JID, not an internal database row ID." - }, - "remoteJidAlt": { - "type": "string" + "description": "Exact remoteJid from the original message key. For group messages this must be the group JID ending in @g.us, not participant, participantAlt, sender, or an internal database row ID." }, "participant": { "type": "string", - "description": "Original group participant JID from the webhook message key. Required for admin deletion." + "description": "Original group participant JID from the webhook message key. It enables delete-for-everyone for another participant’s group message; when unavailable the operation falls back to delete-for-me." }, "participantAlt": { "type": "string", "description": "Alternate participant JID from the webhook message key, used as a fallback for LID/PN resolution." }, - "addressingMode": { - "type": "string", - "enum": [ - "lid", - "pn" - ] + "messageTimestamp": { + "type": "integer", + "minimum": 1, + "description": "Original Unix timestamp in seconds. Required for delete-for-me only when the original message is unavailable in Evolution message storage." + }, + "deleteMedia": { + "type": "boolean", + "default": true, + "description": "Also remove locally stored message media when the selected scope is delete-for-me." } }, "required": [ @@ -7839,8 +8092,8 @@ "tags": [ "Chats" ], - "summary": "Delete delete Message For Everyone", - "description": "Delete delete Message For Everyone for Chats.", + "summary": "Delete message with maximum permitted scope", + "description": "Automatically deletes for everyone when WhatsApp permits it and otherwise deletes for the connected account. The response identifies the applied EVERYONE or ME scope.", "operationId": "delete_chat_deleteMessageForEveryone", "parameters": [ { @@ -8106,44 +8359,94 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { - "application/json": { + "application/x-www-form-urlencoded": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, - "fromMe": { + "remoteJid": { + "type": "string", + "pattern": "^(?:\\d+@(?:s\\.whatsapp\\.net|lid)|\\d+-\\d+@g\\.us|status@broadcast|[^@\\s]+@broadcast)$", + "description": "Exact remoteJid from the original message key. For group messages this must be the group JID ending in @g.us, not participant, participantAlt, sender, or an internal database row ID." + }, + "participant": { + "type": "string", + "description": "Original group participant JID from the webhook message key. It enables delete-for-everyone for another participant’s group message; when unavailable the operation falls back to delete-for-me." + }, + "participantAlt": { + "type": "string", + "description": "Alternate participant JID from the webhook message key, used as a fallback for LID/PN resolution." + }, + "messageTimestamp": { + "type": "integer", + "minimum": 1, + "description": "Original Unix timestamp in seconds. Required for delete-for-me only when the original message is unavailable in Evolution message storage." + }, + "deleteMedia": { "type": "boolean", + "default": true, + "description": "Also remove locally stored message media when the selected scope is delete-for-me." + } + }, + "required": [ + "id", + "remoteJid" + ], + "if": { + "propertyNames": { "enum": [ - true, - false - ], - "description": "Optional ownership override. Omit it to detect ownership from the archived original message. True means the connected account sent it; false selects admin deletion for another participant’s group message." + "id", + "remoteJid" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + }, + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + } + } + } + } + }, + "application/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string" }, "remoteJid": { "type": "string", "pattern": "^(?:\\d+@(?:s\\.whatsapp\\.net|lid)|\\d+-\\d+@g\\.us|status@broadcast|[^@\\s]+@broadcast)$", - "description": "remoteJid must be a full WhatsApp JID, not an internal database row ID." - }, - "remoteJidAlt": { - "type": "string" + "description": "Exact remoteJid from the original message key. For group messages this must be the group JID ending in @g.us, not participant, participantAlt, sender, or an internal database row ID." }, "participant": { "type": "string", - "description": "Original group participant JID from the webhook message key. Required for admin deletion." + "description": "Original group participant JID from the webhook message key. It enables delete-for-everyone for another participant’s group message; when unavailable the operation falls back to delete-for-me." }, "participantAlt": { "type": "string", "description": "Alternate participant JID from the webhook message key, used as a fallback for LID/PN resolution." }, - "addressingMode": { - "type": "string", - "enum": [ - "lid", - "pn" - ] + "messageTimestamp": { + "type": "integer", + "minimum": 1, + "description": "Original Unix timestamp in seconds. Required for delete-for-me only when the original message is unavailable in Evolution message storage." + }, + "deleteMedia": { + "type": "boolean", + "default": true, + "description": "Also remove locally stored message media when the selected scope is delete-for-me." } }, "required": [ @@ -8467,7 +8770,21 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string" + }, + "picture": { + "type": "string" + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -9065,7 +9382,30 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "wuid": { + "type": "string" + }, + "name": { + "type": "string" + }, + "picture": { + "type": "string" + }, + "status": { + "type": "string" + }, + "isBusiness": { + "type": "boolean" + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -9383,7 +9723,21 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string" + }, + "picture": { + "type": "string" + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -10023,7 +10377,66 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "where": { + "type": "object", + "properties": { + "_id": { + "type": "string", + "minLength": 1 + }, + "pushName": { + "type": "string", + "minLength": 1 + }, + "id": { + "type": "string", + "minLength": 1 + }, + "remoteJid": { + "type": "string", + "minLength": 1 + } + }, + "if": { + "propertyNames": { + "enum": [ + "_id", + "id", + "pushName", + "remoteJid" + ] + } + }, + "then": { + "properties": { + "_id": { + "minLength": 1, + "description": "The \"_id\" cannot be empty" + }, + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + }, + "pushName": { + "minLength": 1, + "description": "The \"pushName\" cannot be empty" + }, + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + } + } + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -10422,7 +10835,66 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "where": { + "type": "object", + "properties": { + "_id": { + "type": "string", + "minLength": 1 + }, + "pushName": { + "type": "string", + "minLength": 1 + }, + "id": { + "type": "string", + "minLength": 1 + }, + "remoteJid": { + "type": "string", + "minLength": 1 + } + }, + "if": { + "propertyNames": { + "enum": [ + "_id", + "id", + "pushName", + "remoteJid" + ] + } + }, + "then": { + "properties": { + "_id": { + "minLength": 1, + "description": "The \"_id\" cannot be empty" + }, + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + }, + "pushName": { + "minLength": 1, + "description": "The \"pushName\" cannot be empty" + }, + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + } + } + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -10833,7 +11305,78 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "where": { + "type": "object", + "properties": { + "_id": { + "type": "string", + "minLength": 1 + }, + "key": { + "type": "object", + "if": { + "propertyNames": { + "enum": [ + "fromMe", + "remoteJid", + "id" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "type": "string", + "minLength": 1, + "description": "The property cannot be empty" + }, + "id": { + "type": "string", + "minLength": 1, + "description": "The property cannot be empty" + }, + "fromMe": { + "type": "boolean", + "enum": [ + true, + false + ] + } + } + } + }, + "message": { + "type": "object" + } + }, + "if": { + "propertyNames": { + "enum": [ + "_id" + ] + } + }, + "then": { + "properties": { + "_id": { + "minLength": 1, + "description": "The \"_id\" cannot be empty" + } + } + } + }, + "limit": { + "type": "integer" + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -11261,7 +11804,83 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "where": { + "type": "object", + "properties": { + "_id": { + "type": "string" + }, + "remoteJid": { + "type": "string" + }, + "id": { + "type": "string" + }, + "fromMe": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "participant": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "ERROR", + "PENDING", + "SERVER_ACK", + "DELIVERY_ACK", + "READ", + "PLAYED" + ] + } + }, + "if": { + "propertyNames": { + "enum": [ + "_id", + "remoteJid", + "id", + "status" + ] + } + }, + "then": { + "properties": { + "_id": { + "minLength": 1, + "description": "The \"_id\" cannot be empty" + }, + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + }, + "status": { + "minLength": 1, + "description": "The \"status\" cannot be empty" + } + } + } + }, + "limit": { + "type": "integer" + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -11623,7 +12242,27 @@ "x-source": "src/api/routes/chat.router.ts", "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": { + "message": { + "type": "object", + "additionalProperties": true, + "description": "Baileys WebMessageInfo object." + }, + "convertToMp4": { + "type": "boolean" + } + }, + "required": [ + "message" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -12006,7 +12645,91 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "chat": { + "type": "string" + }, + "lastMessage": { + "type": "object", + "properties": { + "key": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "remoteJid": { + "type": "string" + }, + "fromMe": { + "type": "boolean", + "enum": [ + true, + false + ] + } + }, + "required": [ + "id", + "fromMe", + "remoteJid" + ], + "if": { + "propertyNames": { + "enum": [ + "id", + "remoteJid" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + }, + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + } + } + } + }, + "messageTimestamp": { + "type": "integer", + "minLength": 1 + } + }, + "required": [ + "key" + ], + "if": { + "propertyNames": { + "enum": [ + "messageTimestamp" + ] + } + }, + "then": { + "properties": { + "messageTimestamp": { + "minLength": 1, + "description": "The \"messageTimestamp\" cannot be empty" + } + } + } + } + }, + "required": [ + "lastMessage" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -12429,7 +13152,65 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "readMessages": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "properties": { + "id": { + "type": "string" + }, + "fromMe": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "remoteJid": { + "type": "string" + } + }, + "required": [ + "id", + "fromMe", + "remoteJid" + ], + "if": { + "propertyNames": { + "enum": [ + "id", + "remoteJid" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + }, + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + } + } + } + } + } + }, + "required": [ + "readMessages" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -12782,7 +13563,21 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string" + }, + "picture": { + "type": "string" + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -13107,7 +13902,37 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string", + "description": "Invalid format" + }, + "delay": { + "type": "number" + }, + "presence": { + "type": "string", + "enum": [ + "unavailable", + "available", + "composing", + "recording", + "paused" + ] + } + }, + "required": [ + "number", + "presence", + "delay" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -13460,7 +14285,49 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "block", + "unblock" + ] + } + }, + "required": [ + "number", + "status" + ], + "if": { + "propertyNames": { + "enum": [ + "number", + "status" + ] + } + }, + "then": { + "properties": { + "number": { + "minLength": 1, + "description": "The \"number\" cannot be empty" + }, + "status": { + "minLength": 1, + "description": "The \"status\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -13865,7 +14732,89 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string" + }, + "text": { + "type": "string" + }, + "key": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "remoteJid": { + "type": "string" + }, + "fromMe": { + "type": "boolean", + "enum": [ + true, + false + ] + } + }, + "required": [ + "id", + "fromMe", + "remoteJid" + ], + "if": { + "propertyNames": { + "enum": [ + "id", + "remoteJid" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + }, + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + } + } + } + } + }, + "if": { + "propertyNames": { + "enum": [ + "number", + "text", + "key" + ] + } + }, + "then": { + "properties": { + "number": { + "minLength": 1, + "description": "The \"number\" cannot be empty" + }, + "text": { + "minLength": 1, + "description": "The \"text\" cannot be empty" + }, + "key": { + "minLength": 1, + "description": "The \"key\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -14334,7 +15283,113 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "readreceipts": { + "type": "string", + "enum": [ + "all", + "none" + ] + }, + "profile": { + "type": "string", + "enum": [ + "all", + "contacts", + "contact_blacklist", + "none" + ] + }, + "status": { + "type": "string", + "enum": [ + "all", + "contacts", + "contact_blacklist", + "none" + ] + }, + "online": { + "type": "string", + "enum": [ + "all", + "match_last_seen" + ] + }, + "last": { + "type": "string", + "enum": [ + "all", + "contacts", + "contact_blacklist", + "none" + ] + }, + "groupadd": { + "type": "string", + "enum": [ + "all", + "contacts", + "contact_blacklist", + "none" + ] + } + }, + "required": [ + "readreceipts", + "profile", + "status", + "online", + "last", + "groupadd" + ], + "if": { + "propertyNames": { + "enum": [ + "readreceipts", + "profile", + "status", + "online", + "last", + "groupadd" + ] + } + }, + "then": { + "properties": { + "readreceipts": { + "minLength": 1, + "description": "The \"readreceipts\" cannot be empty" + }, + "profile": { + "minLength": 1, + "description": "The \"profile\" cannot be empty" + }, + "status": { + "minLength": 1, + "description": "The \"status\" cannot be empty" + }, + "online": { + "minLength": 1, + "description": "The \"online\" cannot be empty" + }, + "last": { + "minLength": 1, + "description": "The \"last\" cannot be empty" + }, + "groupadd": { + "minLength": 1, + "description": "The \"groupadd\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -14747,7 +15802,33 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "if": { + "propertyNames": { + "enum": [ + "name" + ] + } + }, + "then": { + "properties": { + "name": { + "minLength": 1, + "description": "The \"name\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -15068,7 +16149,21 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string" + }, + "picture": { + "type": "string" + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -15389,7 +16484,33 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string" + } + }, + "if": { + "propertyNames": { + "enum": [ + "status" + ] + } + }, + "then": { + "properties": { + "status": { + "minLength": 1, + "description": "The \"status\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -15713,7 +16834,24 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "numbers": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "string", + "description": "\"numbers\" must be an array of numeric strings" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -16713,7 +17851,155 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "accountId": { + "type": "string" + }, + "token": { + "type": "string" + }, + "url": { + "type": "string" + }, + "signMsg": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "signDelimiter": { + "type": [ + "string", + "null" + ] + }, + "nameInbox": { + "type": [ + "string", + "null" + ] + }, + "reopenConversation": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "conversationPending": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "autoCreate": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "importContacts": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "mergeBrazilContacts": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "importMessages": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "daysLimitImportMessages": { + "type": "number" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "enabled", + "accountId", + "token", + "url", + "signMsg", + "reopenConversation", + "conversationPending" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "accountId", + "token", + "url", + "signMsg", + "reopenConversation", + "conversationPending" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "accountId": { + "minLength": 1, + "description": "The \"accountId\" cannot be empty" + }, + "token": { + "minLength": 1, + "description": "The \"token\" cannot be empty" + }, + "url": { + "minLength": 1, + "description": "The \"url\" cannot be empty" + }, + "signMsg": { + "minLength": 1, + "description": "The \"signMsg\" cannot be empty" + }, + "reopenConversation": { + "minLength": 1, + "description": "The \"reopenConversation\" cannot be empty" + }, + "conversationPending": { + "minLength": 1, + "description": "The \"conversationPending\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -17419,7 +18705,284 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "instanceName": { + "type": "string" + }, + "token": { + "type": "string" + }, + "number": { + "type": "string", + "pattern": "^\\d+[\\.@\\w-]+" + }, + "businessId": { + "type": "string" + }, + "qrcode": { + "type": "boolean" + }, + "Integration": { + "type": "string", + "enum": [ + "WHATSAPP-BUSINESS", + "WHATSAPP-BAILEYS", + "EVOLUTION" + ] + }, + "rejectCall": { + "type": "boolean" + }, + "msgCall": { + "type": "string" + }, + "groupsIgnore": { + "type": "boolean" + }, + "alwaysOnline": { + "type": "boolean" + }, + "readMessages": { + "type": "boolean" + }, + "readStatus": { + "type": "boolean" + }, + "syncFullHistory": { + "type": "boolean" + }, + "wavoipToken": { + "type": "string" + }, + "proxyHost": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyProtocol": { + "type": "string" + }, + "proxyUsername": { + "type": "string" + }, + "proxyPassword": { + "type": "string" + }, + "webhookUrl": { + "type": "string" + }, + "webhookByEvents": { + "type": "boolean" + }, + "webhookBase64": { + "type": "boolean" + }, + "webhookEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "rabbitmqEnabled": { + "type": "boolean" + }, + "rabbitmqEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "natsEnabled": { + "type": "boolean" + }, + "natsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "sqsEnabled": { + "type": "boolean" + }, + "sqsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "chatwootAccountId": { + "type": "string" + }, + "chatwootToken": { + "type": "string" + }, + "chatwootUrl": { + "type": "string" + }, + "chatwootSignMsg": { + "type": "boolean" + }, + "chatwootReopenConversation": { + "type": "boolean" + }, + "chatwootConversationPending": { + "type": "boolean" + }, + "chatwootImportContacts": { + "type": "boolean" + }, + "chatwootNameInbox": { + "type": "string" + }, + "chatwootMergeBrazilContacts": { + "type": "boolean" + }, + "chatwootImportMessages": { + "type": "boolean" + }, + "chatwootDaysLimitImportMessages": { + "type": "number" + } + }, + "if": { + "propertyNames": { + "enum": [ + "instanceName" + ] + } + }, + "then": { + "properties": { + "instanceName": { + "minLength": 1, + "description": "The \"instanceName\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -18021,7 +19584,51 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "opened", + "closed", + "paused", + "delete" + ] + } + }, + "required": [ + "remoteJid", + "status" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "status" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "status": { + "minLength": 1, + "description": "The \"status\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -18463,7 +20070,124 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "botType": { + "type": "string", + "enum": [ + "chatBot", + "textGenerator", + "agent", + "workflow" + ] + }, + "apiUrl": { + "type": "string" + }, + "apiKey": { + "type": "string" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "enabled", + "botType", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "botType", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "botType": { + "minLength": 1, + "description": "The \"botType\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -19147,7 +20871,284 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "instanceName": { + "type": "string" + }, + "token": { + "type": "string" + }, + "number": { + "type": "string", + "pattern": "^\\d+[\\.@\\w-]+" + }, + "businessId": { + "type": "string" + }, + "qrcode": { + "type": "boolean" + }, + "Integration": { + "type": "string", + "enum": [ + "WHATSAPP-BUSINESS", + "WHATSAPP-BAILEYS", + "EVOLUTION" + ] + }, + "rejectCall": { + "type": "boolean" + }, + "msgCall": { + "type": "string" + }, + "groupsIgnore": { + "type": "boolean" + }, + "alwaysOnline": { + "type": "boolean" + }, + "readMessages": { + "type": "boolean" + }, + "readStatus": { + "type": "boolean" + }, + "syncFullHistory": { + "type": "boolean" + }, + "wavoipToken": { + "type": "string" + }, + "proxyHost": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyProtocol": { + "type": "string" + }, + "proxyUsername": { + "type": "string" + }, + "proxyPassword": { + "type": "string" + }, + "webhookUrl": { + "type": "string" + }, + "webhookByEvents": { + "type": "boolean" + }, + "webhookBase64": { + "type": "boolean" + }, + "webhookEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "rabbitmqEnabled": { + "type": "boolean" + }, + "rabbitmqEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "natsEnabled": { + "type": "boolean" + }, + "natsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "sqsEnabled": { + "type": "boolean" + }, + "sqsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "chatwootAccountId": { + "type": "string" + }, + "chatwootToken": { + "type": "string" + }, + "chatwootUrl": { + "type": "string" + }, + "chatwootSignMsg": { + "type": "boolean" + }, + "chatwootReopenConversation": { + "type": "boolean" + }, + "chatwootConversationPending": { + "type": "boolean" + }, + "chatwootImportContacts": { + "type": "boolean" + }, + "chatwootNameInbox": { + "type": "string" + }, + "chatwootMergeBrazilContacts": { + "type": "boolean" + }, + "chatwootImportMessages": { + "type": "boolean" + }, + "chatwootDaysLimitImportMessages": { + "type": "number" + } + }, + "if": { + "propertyNames": { + "enum": [ + "instanceName" + ] + } + }, + "then": { + "properties": { + "instanceName": { + "minLength": 1, + "description": "The \"instanceName\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -21981,7 +23982,49 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "add", + "remove" + ] + } + }, + "required": [ + "remoteJid", + "action" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "action" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "action": { + "minLength": 1, + "description": "The \"action\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -22429,7 +24472,132 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "difyIdFallback": { + "type": "string" + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe", + "keepOpen", + "debounceTime", + "ignoreJids", + "splitMessages", + "timePerChar" + ], + "if": { + "propertyNames": { + "enum": [ + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe", + "keepOpen", + "debounceTime", + "ignoreJids", + "splitMessages", + "timePerChar" + ] + } + }, + "then": { + "properties": { + "expire": { + "minLength": 1, + "description": "The \"expire\" cannot be empty" + }, + "keywordFinish": { + "minLength": 1, + "description": "The \"keywordFinish\" cannot be empty" + }, + "delayMessage": { + "minLength": 1, + "description": "The \"delayMessage\" cannot be empty" + }, + "unknownMessage": { + "minLength": 1, + "description": "The \"unknownMessage\" cannot be empty" + }, + "listeningFromMe": { + "minLength": 1, + "description": "The \"listeningFromMe\" cannot be empty" + }, + "stopBotFromMe": { + "minLength": 1, + "description": "The \"stopBotFromMe\" cannot be empty" + }, + "keepOpen": { + "minLength": 1, + "description": "The \"keepOpen\" cannot be empty" + }, + "debounceTime": { + "minLength": 1, + "description": "The \"debounceTime\" cannot be empty" + }, + "ignoreJids": { + "minLength": 1, + "description": "The \"ignoreJids\" cannot be empty" + }, + "splitMessages": { + "minLength": 1, + "description": "The \"splitMessages\" cannot be empty" + }, + "timePerChar": { + "minLength": 1, + "description": "The \"timePerChar\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -22961,7 +25129,124 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "botType": { + "type": "string", + "enum": [ + "chatBot", + "textGenerator", + "agent", + "workflow" + ] + }, + "apiUrl": { + "type": "string" + }, + "apiKey": { + "type": "string" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "enabled", + "botType", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "botType", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "botType": { + "minLength": 1, + "description": "The \"botType\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -23403,7 +25688,51 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "opened", + "closed", + "paused", + "delete" + ] + } + }, + "required": [ + "remoteJid", + "status" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "status" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "status": { + "minLength": 1, + "description": "The \"status\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -23836,7 +26165,115 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "agentUrl": { + "type": "string" + }, + "apiKey": { + "type": "string" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "enabled", + "agentUrl", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "agentUrl", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "agentUrl": { + "minLength": 1, + "description": "The \"agentUrl\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -24511,7 +26948,284 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "instanceName": { + "type": "string" + }, + "token": { + "type": "string" + }, + "number": { + "type": "string", + "pattern": "^\\d+[\\.@\\w-]+" + }, + "businessId": { + "type": "string" + }, + "qrcode": { + "type": "boolean" + }, + "Integration": { + "type": "string", + "enum": [ + "WHATSAPP-BUSINESS", + "WHATSAPP-BAILEYS", + "EVOLUTION" + ] + }, + "rejectCall": { + "type": "boolean" + }, + "msgCall": { + "type": "string" + }, + "groupsIgnore": { + "type": "boolean" + }, + "alwaysOnline": { + "type": "boolean" + }, + "readMessages": { + "type": "boolean" + }, + "readStatus": { + "type": "boolean" + }, + "syncFullHistory": { + "type": "boolean" + }, + "wavoipToken": { + "type": "string" + }, + "proxyHost": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyProtocol": { + "type": "string" + }, + "proxyUsername": { + "type": "string" + }, + "proxyPassword": { + "type": "string" + }, + "webhookUrl": { + "type": "string" + }, + "webhookByEvents": { + "type": "boolean" + }, + "webhookBase64": { + "type": "boolean" + }, + "webhookEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "rabbitmqEnabled": { + "type": "boolean" + }, + "rabbitmqEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "natsEnabled": { + "type": "boolean" + }, + "natsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "sqsEnabled": { + "type": "boolean" + }, + "sqsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "chatwootAccountId": { + "type": "string" + }, + "chatwootToken": { + "type": "string" + }, + "chatwootUrl": { + "type": "string" + }, + "chatwootSignMsg": { + "type": "boolean" + }, + "chatwootReopenConversation": { + "type": "boolean" + }, + "chatwootConversationPending": { + "type": "boolean" + }, + "chatwootImportContacts": { + "type": "boolean" + }, + "chatwootNameInbox": { + "type": "string" + }, + "chatwootMergeBrazilContacts": { + "type": "boolean" + }, + "chatwootImportMessages": { + "type": "boolean" + }, + "chatwootDaysLimitImportMessages": { + "type": "number" + } + }, + "if": { + "propertyNames": { + "enum": [ + "instanceName" + ] + } + }, + "then": { + "properties": { + "instanceName": { + "minLength": 1, + "description": "The \"instanceName\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -27345,7 +30059,49 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "add", + "remove" + ] + } + }, + "required": [ + "remoteJid", + "action" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "action" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "action": { + "minLength": 1, + "description": "The \"action\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -27793,7 +30549,132 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "botIdFallback": { + "type": "string" + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe", + "keepOpen", + "debounceTime", + "ignoreJids", + "splitMessages", + "timePerChar" + ], + "if": { + "propertyNames": { + "enum": [ + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe", + "keepOpen", + "debounceTime", + "ignoreJids", + "splitMessages", + "timePerChar" + ] + } + }, + "then": { + "properties": { + "expire": { + "minLength": 1, + "description": "The \"expire\" cannot be empty" + }, + "keywordFinish": { + "minLength": 1, + "description": "The \"keywordFinish\" cannot be empty" + }, + "delayMessage": { + "minLength": 1, + "description": "The \"delayMessage\" cannot be empty" + }, + "unknownMessage": { + "minLength": 1, + "description": "The \"unknownMessage\" cannot be empty" + }, + "listeningFromMe": { + "minLength": 1, + "description": "The \"listeningFromMe\" cannot be empty" + }, + "stopBotFromMe": { + "minLength": 1, + "description": "The \"stopBotFromMe\" cannot be empty" + }, + "keepOpen": { + "minLength": 1, + "description": "The \"keepOpen\" cannot be empty" + }, + "debounceTime": { + "minLength": 1, + "description": "The \"debounceTime\" cannot be empty" + }, + "ignoreJids": { + "minLength": 1, + "description": "The \"ignoreJids\" cannot be empty" + }, + "splitMessages": { + "minLength": 1, + "description": "The \"splitMessages\" cannot be empty" + }, + "timePerChar": { + "minLength": 1, + "description": "The \"timePerChar\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -28316,7 +31197,115 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "agentUrl": { + "type": "string" + }, + "apiKey": { + "type": "string" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "enabled", + "agentUrl", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "agentUrl", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "agentUrl": { + "minLength": 1, + "description": "The \"agentUrl\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -28749,7 +31738,51 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "opened", + "closed", + "paused", + "delete" + ] + } + }, + "required": [ + "remoteJid", + "status" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "status" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "status": { + "minLength": 1, + "description": "The \"status\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -29182,7 +32215,115 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "apiUrl": { + "type": "string" + }, + "apiKey": { + "type": "string" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "enabled", + "apiUrl", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "apiUrl", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "apiUrl": { + "minLength": 1, + "description": "The \"apiUrl\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -29857,7 +32998,284 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "instanceName": { + "type": "string" + }, + "token": { + "type": "string" + }, + "number": { + "type": "string", + "pattern": "^\\d+[\\.@\\w-]+" + }, + "businessId": { + "type": "string" + }, + "qrcode": { + "type": "boolean" + }, + "Integration": { + "type": "string", + "enum": [ + "WHATSAPP-BUSINESS", + "WHATSAPP-BAILEYS", + "EVOLUTION" + ] + }, + "rejectCall": { + "type": "boolean" + }, + "msgCall": { + "type": "string" + }, + "groupsIgnore": { + "type": "boolean" + }, + "alwaysOnline": { + "type": "boolean" + }, + "readMessages": { + "type": "boolean" + }, + "readStatus": { + "type": "boolean" + }, + "syncFullHistory": { + "type": "boolean" + }, + "wavoipToken": { + "type": "string" + }, + "proxyHost": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyProtocol": { + "type": "string" + }, + "proxyUsername": { + "type": "string" + }, + "proxyPassword": { + "type": "string" + }, + "webhookUrl": { + "type": "string" + }, + "webhookByEvents": { + "type": "boolean" + }, + "webhookBase64": { + "type": "boolean" + }, + "webhookEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "rabbitmqEnabled": { + "type": "boolean" + }, + "rabbitmqEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "natsEnabled": { + "type": "boolean" + }, + "natsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "sqsEnabled": { + "type": "boolean" + }, + "sqsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "chatwootAccountId": { + "type": "string" + }, + "chatwootToken": { + "type": "string" + }, + "chatwootUrl": { + "type": "string" + }, + "chatwootSignMsg": { + "type": "boolean" + }, + "chatwootReopenConversation": { + "type": "boolean" + }, + "chatwootConversationPending": { + "type": "boolean" + }, + "chatwootImportContacts": { + "type": "boolean" + }, + "chatwootNameInbox": { + "type": "string" + }, + "chatwootMergeBrazilContacts": { + "type": "boolean" + }, + "chatwootImportMessages": { + "type": "boolean" + }, + "chatwootDaysLimitImportMessages": { + "type": "number" + } + }, + "if": { + "propertyNames": { + "enum": [ + "instanceName" + ] + } + }, + "then": { + "properties": { + "instanceName": { + "minLength": 1, + "description": "The \"instanceName\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -32691,7 +36109,49 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "add", + "remove" + ] + } + }, + "required": [ + "remoteJid", + "action" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "action" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "action": { + "minLength": 1, + "description": "The \"action\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -33139,7 +36599,132 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "botIdFallback": { + "type": "string" + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe", + "keepOpen", + "debounceTime", + "ignoreJids", + "splitMessages", + "timePerChar" + ], + "if": { + "propertyNames": { + "enum": [ + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe", + "keepOpen", + "debounceTime", + "ignoreJids", + "splitMessages", + "timePerChar" + ] + } + }, + "then": { + "properties": { + "expire": { + "minLength": 1, + "description": "The \"expire\" cannot be empty" + }, + "keywordFinish": { + "minLength": 1, + "description": "The \"keywordFinish\" cannot be empty" + }, + "delayMessage": { + "minLength": 1, + "description": "The \"delayMessage\" cannot be empty" + }, + "unknownMessage": { + "minLength": 1, + "description": "The \"unknownMessage\" cannot be empty" + }, + "listeningFromMe": { + "minLength": 1, + "description": "The \"listeningFromMe\" cannot be empty" + }, + "stopBotFromMe": { + "minLength": 1, + "description": "The \"stopBotFromMe\" cannot be empty" + }, + "keepOpen": { + "minLength": 1, + "description": "The \"keepOpen\" cannot be empty" + }, + "debounceTime": { + "minLength": 1, + "description": "The \"debounceTime\" cannot be empty" + }, + "ignoreJids": { + "minLength": 1, + "description": "The \"ignoreJids\" cannot be empty" + }, + "splitMessages": { + "minLength": 1, + "description": "The \"splitMessages\" cannot be empty" + }, + "timePerChar": { + "minLength": 1, + "description": "The \"timePerChar\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -33662,7 +37247,115 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "apiUrl": { + "type": "string" + }, + "apiKey": { + "type": "string" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "enabled", + "apiUrl", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "apiUrl", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "apiUrl": { + "minLength": 1, + "description": "The \"apiUrl\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -34095,7 +37788,51 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "opened", + "closed", + "paused", + "delete" + ] + } + }, + "required": [ + "remoteJid", + "status" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "status" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "status": { + "minLength": 1, + "description": "The \"status\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -34528,7 +38265,115 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "apiUrl": { + "type": "string" + }, + "apiKey": { + "type": "string" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "enabled", + "apiUrl", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "apiUrl", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "apiUrl": { + "minLength": 1, + "description": "The \"apiUrl\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -35203,7 +39048,284 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "instanceName": { + "type": "string" + }, + "token": { + "type": "string" + }, + "number": { + "type": "string", + "pattern": "^\\d+[\\.@\\w-]+" + }, + "businessId": { + "type": "string" + }, + "qrcode": { + "type": "boolean" + }, + "Integration": { + "type": "string", + "enum": [ + "WHATSAPP-BUSINESS", + "WHATSAPP-BAILEYS", + "EVOLUTION" + ] + }, + "rejectCall": { + "type": "boolean" + }, + "msgCall": { + "type": "string" + }, + "groupsIgnore": { + "type": "boolean" + }, + "alwaysOnline": { + "type": "boolean" + }, + "readMessages": { + "type": "boolean" + }, + "readStatus": { + "type": "boolean" + }, + "syncFullHistory": { + "type": "boolean" + }, + "wavoipToken": { + "type": "string" + }, + "proxyHost": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyProtocol": { + "type": "string" + }, + "proxyUsername": { + "type": "string" + }, + "proxyPassword": { + "type": "string" + }, + "webhookUrl": { + "type": "string" + }, + "webhookByEvents": { + "type": "boolean" + }, + "webhookBase64": { + "type": "boolean" + }, + "webhookEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "rabbitmqEnabled": { + "type": "boolean" + }, + "rabbitmqEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "natsEnabled": { + "type": "boolean" + }, + "natsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "sqsEnabled": { + "type": "boolean" + }, + "sqsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "chatwootAccountId": { + "type": "string" + }, + "chatwootToken": { + "type": "string" + }, + "chatwootUrl": { + "type": "string" + }, + "chatwootSignMsg": { + "type": "boolean" + }, + "chatwootReopenConversation": { + "type": "boolean" + }, + "chatwootConversationPending": { + "type": "boolean" + }, + "chatwootImportContacts": { + "type": "boolean" + }, + "chatwootNameInbox": { + "type": "string" + }, + "chatwootMergeBrazilContacts": { + "type": "boolean" + }, + "chatwootImportMessages": { + "type": "boolean" + }, + "chatwootDaysLimitImportMessages": { + "type": "number" + } + }, + "if": { + "propertyNames": { + "enum": [ + "instanceName" + ] + } + }, + "then": { + "properties": { + "instanceName": { + "minLength": 1, + "description": "The \"instanceName\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -38037,7 +42159,49 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "add", + "remove" + ] + } + }, + "required": [ + "remoteJid", + "action" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "action" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "action": { + "minLength": 1, + "description": "The \"action\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -38473,7 +42637,120 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "flowiseIdFallback": { + "type": "string" + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe", + "keepOpen", + "debounceTime", + "ignoreJids" + ], + "if": { + "propertyNames": { + "enum": [ + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe", + "keepOpen", + "debounceTime", + "ignoreJids" + ] + } + }, + "then": { + "properties": { + "expire": { + "minLength": 1, + "description": "The \"expire\" cannot be empty" + }, + "keywordFinish": { + "minLength": 1, + "description": "The \"keywordFinish\" cannot be empty" + }, + "delayMessage": { + "minLength": 1, + "description": "The \"delayMessage\" cannot be empty" + }, + "unknownMessage": { + "minLength": 1, + "description": "The \"unknownMessage\" cannot be empty" + }, + "listeningFromMe": { + "minLength": 1, + "description": "The \"listeningFromMe\" cannot be empty" + }, + "stopBotFromMe": { + "minLength": 1, + "description": "The \"stopBotFromMe\" cannot be empty" + }, + "keepOpen": { + "minLength": 1, + "description": "The \"keepOpen\" cannot be empty" + }, + "debounceTime": { + "minLength": 1, + "description": "The \"debounceTime\" cannot be empty" + }, + "ignoreJids": { + "minLength": 1, + "description": "The \"ignoreJids\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -38984,7 +43261,115 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "apiUrl": { + "type": "string" + }, + "apiKey": { + "type": "string" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "enabled", + "apiUrl", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "apiUrl", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "apiUrl": { + "minLength": 1, + "description": "The \"apiUrl\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -39753,7 +44138,71 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "subject": { + "type": "string" + }, + "description": { + "type": "string" + }, + "profilePicture": { + "type": "string" + }, + "promoteParticipants": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "participants": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "string", + "minLength": 10, + "pattern": "\\d+", + "description": "\"participants\" must be an array of numeric strings" + } + } + }, + "required": [ + "subject", + "participants" + ], + "if": { + "propertyNames": { + "enum": [ + "subject", + "description", + "profilePicture" + ] + } + }, + "then": { + "properties": { + "subject": { + "minLength": 1, + "description": "The \"subject\" cannot be empty" + }, + "description": { + "minLength": 1, + "description": "The \"description\" cannot be empty" + }, + "profilePicture": { + "minLength": 1, + "description": "The \"profilePicture\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -41992,7 +46441,37 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "groupJid": { + "type": "string", + "pattern": "^[\\d-]+@g.us$" + } + }, + "required": [ + "groupJid" + ], + "if": { + "propertyNames": { + "enum": [ + "groupJid" + ] + } + }, + "then": { + "properties": { + "groupJid": { + "minLength": 1, + "description": "The \"groupJid\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -42358,7 +46837,62 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "groupJid": { + "type": "string" + }, + "description": { + "type": "string" + }, + "numbers": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "string", + "minLength": 10, + "pattern": "\\d+", + "description": "\"numbers\" must be an array of numeric strings" + } + } + }, + "required": [ + "groupJid", + "description", + "numbers" + ], + "if": { + "propertyNames": { + "enum": [ + "groupJid", + "description", + "numbers" + ] + } + }, + "then": { + "properties": { + "groupJid": { + "minLength": 1, + "description": "The \"groupJid\" cannot be empty" + }, + "description": { + "minLength": 1, + "description": "The \"description\" cannot be empty" + }, + "numbers": { + "minLength": 1, + "description": "The \"numbers\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -42738,7 +47272,51 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "groupJid": { + "type": "string" + }, + "expiration": { + "type": "number", + "enum": [ + 0, + 86400, + 604800, + 7776000 + ] + } + }, + "required": [ + "groupJid", + "expiration" + ], + "if": { + "propertyNames": { + "enum": [ + "groupJid", + "expiration" + ] + } + }, + "then": { + "properties": { + "groupJid": { + "minLength": 1, + "description": "The \"groupJid\" cannot be empty" + }, + "expiration": { + "minLength": 1, + "description": "The \"expiration\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -43101,7 +47679,45 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "groupJid": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "groupJid", + "description" + ], + "if": { + "propertyNames": { + "enum": [ + "groupJid", + "description" + ] + } + }, + "then": { + "properties": { + "groupJid": { + "minLength": 1, + "description": "The \"groupJid\" cannot be empty" + }, + "description": { + "minLength": 1, + "description": "The \"description\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -43458,7 +48074,45 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "groupJid": { + "type": "string" + }, + "image": { + "type": "string" + } + }, + "required": [ + "groupJid", + "image" + ], + "if": { + "propertyNames": { + "enum": [ + "groupJid", + "image" + ] + } + }, + "then": { + "properties": { + "groupJid": { + "minLength": 1, + "description": "The \"groupJid\" cannot be empty" + }, + "image": { + "minLength": 1, + "description": "The \"image\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -43815,7 +48469,45 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "groupJid": { + "type": "string" + }, + "subject": { + "type": "string" + } + }, + "required": [ + "groupJid", + "subject" + ], + "if": { + "propertyNames": { + "enum": [ + "groupJid", + "subject" + ] + } + }, + "then": { + "properties": { + "groupJid": { + "minLength": 1, + "description": "The \"groupJid\" cannot be empty" + }, + "subject": { + "minLength": 1, + "description": "The \"subject\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -44190,7 +48882,63 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "groupJid": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "add", + "remove", + "promote", + "demote" + ] + }, + "participants": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "string", + "minLength": 10, + "pattern": "\\d+", + "description": "\"participants\" must be an array of numeric strings" + } + } + }, + "required": [ + "groupJid", + "action", + "participants" + ], + "if": { + "propertyNames": { + "enum": [ + "groupJid", + "action" + ] + } + }, + "then": { + "properties": { + "groupJid": { + "minLength": 1, + "description": "The \"groupJid\" cannot be empty" + }, + "action": { + "minLength": 1, + "description": "The \"action\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -44571,7 +49319,51 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "groupJid": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "announcement", + "not_announcement", + "locked", + "unlocked" + ] + } + }, + "required": [ + "groupJid", + "action" + ], + "if": { + "propertyNames": { + "enum": [ + "groupJid", + "action" + ] + } + }, + "then": { + "properties": { + "groupJid": { + "minLength": 1, + "description": "The \"groupJid\" cannot be empty" + }, + "action": { + "minLength": 1, + "description": "The \"action\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -45731,7 +50523,284 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "instanceName": { + "type": "string" + }, + "token": { + "type": "string" + }, + "number": { + "type": "string", + "pattern": "^\\d+[\\.@\\w-]+" + }, + "businessId": { + "type": "string" + }, + "qrcode": { + "type": "boolean" + }, + "Integration": { + "type": "string", + "enum": [ + "WHATSAPP-BUSINESS", + "WHATSAPP-BAILEYS", + "EVOLUTION" + ] + }, + "rejectCall": { + "type": "boolean" + }, + "msgCall": { + "type": "string" + }, + "groupsIgnore": { + "type": "boolean" + }, + "alwaysOnline": { + "type": "boolean" + }, + "readMessages": { + "type": "boolean" + }, + "readStatus": { + "type": "boolean" + }, + "syncFullHistory": { + "type": "boolean" + }, + "wavoipToken": { + "type": "string" + }, + "proxyHost": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyProtocol": { + "type": "string" + }, + "proxyUsername": { + "type": "string" + }, + "proxyPassword": { + "type": "string" + }, + "webhookUrl": { + "type": "string" + }, + "webhookByEvents": { + "type": "boolean" + }, + "webhookBase64": { + "type": "boolean" + }, + "webhookEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "rabbitmqEnabled": { + "type": "boolean" + }, + "rabbitmqEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "natsEnabled": { + "type": "boolean" + }, + "natsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "sqsEnabled": { + "type": "boolean" + }, + "sqsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "chatwootAccountId": { + "type": "string" + }, + "chatwootToken": { + "type": "string" + }, + "chatwootUrl": { + "type": "string" + }, + "chatwootSignMsg": { + "type": "boolean" + }, + "chatwootReopenConversation": { + "type": "boolean" + }, + "chatwootConversationPending": { + "type": "boolean" + }, + "chatwootImportContacts": { + "type": "boolean" + }, + "chatwootNameInbox": { + "type": "string" + }, + "chatwootMergeBrazilContacts": { + "type": "boolean" + }, + "chatwootImportMessages": { + "type": "boolean" + }, + "chatwootDaysLimitImportMessages": { + "type": "number" + } + }, + "if": { + "propertyNames": { + "enum": [ + "instanceName" + ] + } + }, + "then": { + "properties": { + "instanceName": { + "minLength": 1, + "description": "The \"instanceName\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -47121,7 +52190,16 @@ "x-source": "src/api/routes/instance.router.ts", "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": {}, + "required": [] + } + }, "application/json": { "schema": { "type": "object", @@ -47430,7 +52508,28 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "presence": { + "type": "string", + "enum": [ + "unavailable", + "available", + "composing", + "recording", + "paused" + ] + } + }, + "required": [ + "presence" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -48653,7 +53752,105 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "websocket": { + "$ref": "#/$defs/event" + }, + "rabbitmq": { + "$ref": "#/$defs/event" + }, + "nats": { + "$ref": "#/$defs/event" + }, + "sqs": { + "$ref": "#/$defs/event" + }, + "kafka": { + "$ref": "#/$defs/event" + } + }, + "$defs": { + "event": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "events": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUPS_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS", + "REMOVE_INSTANCE", + "LOGOUT_INSTANCE", + "INSTANCE_CREATE", + "INSTANCE_DELETE", + "STATUS_INSTANCE", + "CREDS_UPDATE", + "MESSAGING_HISTORY_SET", + "MESSAGING_HISTORY_STATUS", + "LID_MAPPING_UPDATE", + "MESSAGES_MEDIA_UPDATE", + "MESSAGES_REACTION", + "MESSAGE_RECEIPT_UPDATE", + "GROUP_JOIN_REQUEST", + "GROUP_MEMBER_TAG_UPDATE", + "BLOCKLIST_SET", + "BLOCKLIST_UPDATE", + "NEWSLETTER_REACTION", + "NEWSLETTER_VIEW", + "NEWSLETTER_PARTICIPANTS_UPDATE", + "NEWSLETTER_SETTINGS_UPDATE", + "MESSAGE_CAPPING_UPDATE", + "CHATS_LOCK", + "SETTINGS_UPDATE" + ] + } + } + }, + "required": [ + "enabled" + ] + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -49364,7 +54561,59 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string", + "description": "Invalid format" + }, + "labelId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "add", + "remove" + ] + } + }, + "required": [ + "number", + "labelId", + "action" + ], + "if": { + "propertyNames": { + "enum": [ + "number", + "labelId", + "action" + ] + } + }, + "then": { + "properties": { + "number": { + "minLength": 1, + "description": "The \"number\" cannot be empty" + }, + "labelId": { + "minLength": 1, + "description": "The \"labelId\" cannot be empty" + }, + "action": { + "minLength": 1, + "description": "The \"action\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -49886,7 +55135,196 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string", + "pattern": "^(?!@[^@\\s]+$).+", + "description": "Use a phone number or full WhatsApp JID. A raw @username must first be resolved to an authoritative @lid JID." + }, + "settingsTemplateId": { + "type": "string", + "minLength": 1 + }, + "thumbnailUrl": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "footer": { + "type": "string" + }, + "buttons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "reply", + "copy", + "url", + "call", + "pix" + ] + }, + "displayText": { + "type": "string" + }, + "id": { + "type": "string" + }, + "url": { + "type": "string" + }, + "phoneNumber": { + "type": "string" + }, + "currency": { + "type": "string" + }, + "name": { + "type": "string" + }, + "keyType": { + "type": "string", + "enum": [ + "phone", + "email", + "cpf", + "cnpj", + "random" + ] + }, + "key": { + "type": "string" + } + }, + "required": [ + "type" + ], + "if": { + "propertyNames": { + "enum": [ + "id", + "url", + "phoneNumber" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + }, + "url": { + "minLength": 1, + "description": "The \"url\" cannot be empty" + }, + "phoneNumber": { + "minLength": 1, + "description": "The \"phoneNumber\" cannot be empty" + } + } + } + } + }, + "delay": { + "type": "integer", + "description": "Enter a value in milliseconds" + }, + "quoted": { + "properties": { + "key": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "remoteJid": { + "type": "string" + }, + "remoteJidAlt": { + "type": "string" + }, + "participant": { + "type": "string" + }, + "participantAlt": { + "type": "string" + }, + "addressingMode": { + "type": "string", + "enum": [ + "lid", + "pn" + ] + }, + "fromMe": { + "type": "boolean", + "enum": [ + true, + false + ] + } + }, + "required": [ + "id" + ], + "if": { + "propertyNames": { + "enum": [ + "id" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + } + } + } + }, + "message": { + "type": "object" + } + } + }, + "everyOne": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "mentioned": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "string", + "pattern": "^\\d+", + "description": "\"mentioned\" must be an array of numeric strings" + } + } + }, + "required": [ + "number" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -50428,7 +55866,79 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string", + "pattern": "^(?!@[^@\\s]+$).+", + "description": "Use a phone number or full WhatsApp JID. A raw @username must first be resolved to an authoritative @lid JID." + }, + "settingsTemplateId": { + "type": "string", + "minLength": 1 + }, + "contact": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fullName": { + "type": "string" + }, + "wuid": { + "type": "string", + "minLength": 10, + "pattern": "\\d+", + "description": "\"wuid\" must be a numeric string" + }, + "phoneNumber": { + "type": "string", + "minLength": 10 + }, + "organization": { + "type": "string" + }, + "email": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "required": [ + "fullName", + "phoneNumber" + ], + "if": { + "propertyNames": { + "enum": [ + "fullName" + ] + } + }, + "then": { + "properties": { + "fullName": { + "minLength": 1, + "description": "The \"fullName\" cannot be empty" + } + } + } + }, + "minItems": 1, + "uniqueItems": true + } + }, + "required": [ + "number", + "contact" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -50977,7 +56487,203 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string", + "pattern": "^(?!@[^@\\s]+$).+", + "description": "Use a phone number or full WhatsApp JID. A raw @username must first be resolved to an authoritative @lid JID." + }, + "settingsTemplateId": { + "type": "string", + "minLength": 1 + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "footerText": { + "type": "string" + }, + "buttonText": { + "type": "string" + }, + "sections": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "rows": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "rowId": { + "type": "string" + } + }, + "required": [ + "title", + "rowId" + ], + "if": { + "propertyNames": { + "enum": [ + "title", + "description", + "rowId" + ] + } + }, + "then": { + "properties": { + "title": { + "minLength": 1, + "description": "The \"title\" cannot be empty" + }, + "description": { + "minLength": 1, + "description": "The \"description\" cannot be empty" + }, + "rowId": { + "minLength": 1, + "description": "The \"rowId\" cannot be empty" + } + } + } + } + } + }, + "required": [ + "title", + "rows" + ], + "if": { + "propertyNames": { + "enum": [ + "title" + ] + } + }, + "then": { + "properties": { + "title": { + "minLength": 1, + "description": "The \"title\" cannot be empty" + } + } + } + } + }, + "delay": { + "type": "integer", + "description": "Enter a value in milliseconds" + }, + "quoted": { + "properties": { + "key": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "remoteJid": { + "type": "string" + }, + "remoteJidAlt": { + "type": "string" + }, + "participant": { + "type": "string" + }, + "participantAlt": { + "type": "string" + }, + "addressingMode": { + "type": "string", + "enum": [ + "lid", + "pn" + ] + }, + "fromMe": { + "type": "boolean", + "enum": [ + true, + false + ] + } + }, + "required": [ + "id" + ], + "if": { + "propertyNames": { + "enum": [ + "id" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + } + } + } + }, + "message": { + "type": "object" + } + } + }, + "everyOne": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "mentioned": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "string", + "pattern": "^\\d+", + "description": "\"mentioned\" must be an array of numeric strings" + } + } + }, + "required": [ + "number", + "title", + "footerText", + "buttonText", + "sections" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -51570,7 +57276,123 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string", + "pattern": "^(?!@[^@\\s]+$).+", + "description": "Use a phone number or full WhatsApp JID. A raw @username must first be resolved to an authoritative @lid JID." + }, + "settingsTemplateId": { + "type": "string", + "minLength": 1 + }, + "latitude": { + "type": "number" + }, + "longitude": { + "type": "number" + }, + "name": { + "type": "string" + }, + "address": { + "type": "string" + }, + "delay": { + "type": "integer", + "description": "Enter a value in milliseconds" + }, + "quoted": { + "properties": { + "key": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "remoteJid": { + "type": "string" + }, + "remoteJidAlt": { + "type": "string" + }, + "participant": { + "type": "string" + }, + "participantAlt": { + "type": "string" + }, + "addressingMode": { + "type": "string", + "enum": [ + "lid", + "pn" + ] + }, + "fromMe": { + "type": "boolean", + "enum": [ + true, + false + ] + } + }, + "required": [ + "id" + ], + "if": { + "propertyNames": { + "enum": [ + "id" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + } + } + } + }, + "message": { + "type": "object" + } + } + }, + "everyOne": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "mentioned": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "string", + "pattern": "^\\d+", + "description": "\"mentioned\" must be an array of numeric strings" + } + } + }, + "required": [ + "number", + "latitude", + "longitude", + "name", + "address" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -52616,7 +58438,127 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string", + "pattern": "^(?!@[^@\\s]+$).+", + "description": "Use a phone number or full WhatsApp JID. A raw @username must first be resolved to an authoritative @lid JID." + }, + "settingsTemplateId": { + "type": "string", + "minLength": 1 + }, + "name": { + "type": "string" + }, + "selectableCount": { + "type": "integer", + "minimum": 0, + "maximum": 10 + }, + "values": { + "type": "array", + "minItems": 2, + "maxItems": 10, + "uniqueItems": true, + "items": { + "type": "string" + } + }, + "delay": { + "type": "integer", + "description": "Enter a value in milliseconds" + }, + "quoted": { + "properties": { + "key": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "remoteJid": { + "type": "string" + }, + "remoteJidAlt": { + "type": "string" + }, + "participant": { + "type": "string" + }, + "participantAlt": { + "type": "string" + }, + "addressingMode": { + "type": "string", + "enum": [ + "lid", + "pn" + ] + }, + "fromMe": { + "type": "boolean", + "enum": [ + true, + false + ] + } + }, + "required": [ + "id" + ], + "if": { + "propertyNames": { + "enum": [ + "id" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + } + } + } + }, + "message": { + "type": "object" + } + } + }, + "everyOne": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "mentioned": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "string", + "pattern": "^\\d+", + "description": "\"mentioned\" must be an array of numeric strings" + } + } + }, + "required": [ + "number", + "name", + "selectableCount", + "values" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -53582,7 +59524,81 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "key": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "remoteJid": { + "type": "string" + }, + "remoteJidAlt": { + "type": "string" + }, + "participant": { + "type": "string" + }, + "participantAlt": { + "type": "string" + }, + "addressingMode": { + "type": "string", + "enum": [ + "lid", + "pn" + ] + }, + "fromMe": { + "type": "boolean", + "enum": [ + true, + false + ] + } + }, + "required": [ + "id", + "remoteJid", + "fromMe" + ], + "if": { + "propertyNames": { + "enum": [ + "id", + "remoteJid" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + }, + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + } + } + } + }, + "reaction": { + "type": "string" + } + }, + "required": [ + "key", + "reaction" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -54848,7 +60864,40 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string", + "pattern": "^(?!@[^@\\s]+$).+", + "description": "Use a phone number or full WhatsApp JID. A raw @username must first be resolved to an authoritative @lid JID." + }, + "settingsTemplateId": { + "type": "string", + "minLength": 1 + }, + "name": { + "type": "string" + }, + "language": { + "type": "string" + }, + "components": { + "type": "array" + }, + "webhookUrl": { + "type": "string" + } + }, + "required": [ + "name", + "language" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -55269,7 +61318,114 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "number": { + "type": "string", + "pattern": "^(?!@[^@\\s]+$).+", + "description": "Use a phone number or full WhatsApp JID. A raw @username must first be resolved to an authoritative @lid JID." + }, + "settingsTemplateId": { + "type": "string", + "minLength": 1 + }, + "text": { + "type": "string" + }, + "linkPreview": { + "type": "boolean" + }, + "delay": { + "type": "integer", + "description": "Enter a value in milliseconds" + }, + "quoted": { + "properties": { + "key": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "remoteJid": { + "type": "string" + }, + "remoteJidAlt": { + "type": "string" + }, + "participant": { + "type": "string" + }, + "participantAlt": { + "type": "string" + }, + "addressingMode": { + "type": "string", + "enum": [ + "lid", + "pn" + ] + }, + "fromMe": { + "type": "boolean", + "enum": [ + true, + false + ] + } + }, + "required": [ + "id" + ], + "if": { + "propertyNames": { + "enum": [ + "id" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + } + } + } + }, + "message": { + "type": "object" + } + } + }, + "everyOne": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "mentioned": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "string", + "pattern": "^\\d+", + "description": "\"mentioned\" must be an array of numeric strings" + } + } + }, + "required": [ + "number", + "text" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -56192,7 +62348,51 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "opened", + "closed", + "paused", + "delete" + ] + } + }, + "required": [ + "remoteJid", + "status" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "status" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "status": { + "minLength": 1, + "description": "The \"status\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -56628,7 +62828,118 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "webhookUrl": { + "type": "string" + }, + "basicAuthUser": { + "type": "string" + }, + "basicAuthPassword": { + "type": "string" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "enabled", + "webhookUrl", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "webhookUrl", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "webhookUrl": { + "minLength": 1, + "description": "The \"webhookUrl\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -57306,7 +63617,284 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "instanceName": { + "type": "string" + }, + "token": { + "type": "string" + }, + "number": { + "type": "string", + "pattern": "^\\d+[\\.@\\w-]+" + }, + "businessId": { + "type": "string" + }, + "qrcode": { + "type": "boolean" + }, + "Integration": { + "type": "string", + "enum": [ + "WHATSAPP-BUSINESS", + "WHATSAPP-BAILEYS", + "EVOLUTION" + ] + }, + "rejectCall": { + "type": "boolean" + }, + "msgCall": { + "type": "string" + }, + "groupsIgnore": { + "type": "boolean" + }, + "alwaysOnline": { + "type": "boolean" + }, + "readMessages": { + "type": "boolean" + }, + "readStatus": { + "type": "boolean" + }, + "syncFullHistory": { + "type": "boolean" + }, + "wavoipToken": { + "type": "string" + }, + "proxyHost": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyProtocol": { + "type": "string" + }, + "proxyUsername": { + "type": "string" + }, + "proxyPassword": { + "type": "string" + }, + "webhookUrl": { + "type": "string" + }, + "webhookByEvents": { + "type": "boolean" + }, + "webhookBase64": { + "type": "boolean" + }, + "webhookEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "rabbitmqEnabled": { + "type": "boolean" + }, + "rabbitmqEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "natsEnabled": { + "type": "boolean" + }, + "natsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "sqsEnabled": { + "type": "boolean" + }, + "sqsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "chatwootAccountId": { + "type": "string" + }, + "chatwootToken": { + "type": "string" + }, + "chatwootUrl": { + "type": "string" + }, + "chatwootSignMsg": { + "type": "boolean" + }, + "chatwootReopenConversation": { + "type": "boolean" + }, + "chatwootConversationPending": { + "type": "boolean" + }, + "chatwootImportContacts": { + "type": "boolean" + }, + "chatwootNameInbox": { + "type": "string" + }, + "chatwootMergeBrazilContacts": { + "type": "boolean" + }, + "chatwootImportMessages": { + "type": "boolean" + }, + "chatwootDaysLimitImportMessages": { + "type": "number" + } + }, + "if": { + "propertyNames": { + "enum": [ + "instanceName" + ] + } + }, + "then": { + "properties": { + "instanceName": { + "minLength": 1, + "description": "The \"instanceName\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -60140,7 +66728,49 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "add", + "remove" + ] + } + }, + "required": [ + "remoteJid", + "action" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "action" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "action": { + "minLength": 1, + "description": "The \"action\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -60588,7 +67218,132 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "botIdFallback": { + "type": "string" + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe", + "keepOpen", + "debounceTime", + "ignoreJids", + "splitMessages", + "timePerChar" + ], + "if": { + "propertyNames": { + "enum": [ + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe", + "keepOpen", + "debounceTime", + "ignoreJids", + "splitMessages", + "timePerChar" + ] + } + }, + "then": { + "properties": { + "expire": { + "minLength": 1, + "description": "The \"expire\" cannot be empty" + }, + "keywordFinish": { + "minLength": 1, + "description": "The \"keywordFinish\" cannot be empty" + }, + "delayMessage": { + "minLength": 1, + "description": "The \"delayMessage\" cannot be empty" + }, + "unknownMessage": { + "minLength": 1, + "description": "The \"unknownMessage\" cannot be empty" + }, + "listeningFromMe": { + "minLength": 1, + "description": "The \"listeningFromMe\" cannot be empty" + }, + "stopBotFromMe": { + "minLength": 1, + "description": "The \"stopBotFromMe\" cannot be empty" + }, + "keepOpen": { + "minLength": 1, + "description": "The \"keepOpen\" cannot be empty" + }, + "debounceTime": { + "minLength": 1, + "description": "The \"debounceTime\" cannot be empty" + }, + "ignoreJids": { + "minLength": 1, + "description": "The \"ignoreJids\" cannot be empty" + }, + "splitMessages": { + "minLength": 1, + "description": "The \"splitMessages\" cannot be empty" + }, + "timePerChar": { + "minLength": 1, + "description": "The \"timePerChar\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -61114,7 +67869,118 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "webhookUrl": { + "type": "string" + }, + "basicAuthUser": { + "type": "string" + }, + "basicAuthPassword": { + "type": "string" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "splitMessages": { + "type": "boolean" + }, + "timePerChar": { + "type": "integer" + } + }, + "required": [ + "enabled", + "webhookUrl", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "webhookUrl", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "webhookUrl": { + "minLength": 1, + "description": "The \"webhookUrl\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -62157,7 +69023,105 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "websocket": { + "$ref": "#/$defs/event" + }, + "rabbitmq": { + "$ref": "#/$defs/event" + }, + "nats": { + "$ref": "#/$defs/event" + }, + "sqs": { + "$ref": "#/$defs/event" + }, + "kafka": { + "$ref": "#/$defs/event" + } + }, + "$defs": { + "event": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "events": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUPS_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS", + "REMOVE_INSTANCE", + "LOGOUT_INSTANCE", + "INSTANCE_CREATE", + "INSTANCE_DELETE", + "STATUS_INSTANCE", + "CREDS_UPDATE", + "MESSAGING_HISTORY_SET", + "MESSAGING_HISTORY_STATUS", + "LID_MAPPING_UPDATE", + "MESSAGES_MEDIA_UPDATE", + "MESSAGES_REACTION", + "MESSAGE_RECEIPT_UPDATE", + "GROUP_JOIN_REQUEST", + "GROUP_MEMBER_TAG_UPDATE", + "BLOCKLIST_SET", + "BLOCKLIST_UPDATE", + "NEWSLETTER_REACTION", + "NEWSLETTER_VIEW", + "NEWSLETTER_PARTICIPANTS_UPDATE", + "NEWSLETTER_SETTINGS_UPDATE", + "MESSAGE_CAPPING_UPDATE", + "CHATS_LOCK", + "SETTINGS_UPDATE" + ] + } + } + }, + "required": [ + "enabled" + ] + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -62580,7 +69544,51 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "opened", + "closed", + "paused", + "delete" + ] + } + }, + "required": [ + "remoteJid", + "status" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "status" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "status": { + "minLength": 1, + "description": "The \"status\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -63047,7 +70055,149 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "openaiCredsId": { + "type": "string" + }, + "botType": { + "type": "string", + "enum": [ + "assistant", + "chatCompletion" + ] + }, + "assistantId": { + "type": "string" + }, + "functionUrl": { + "type": "string" + }, + "model": { + "type": "string" + }, + "systemMessages": { + "type": "array", + "items": { + "type": "string" + } + }, + "assistantMessages": { + "type": "array", + "items": { + "type": "string" + } + }, + "userMessages": { + "type": "array", + "items": { + "type": "string" + } + }, + "maxTokens": { + "type": "integer" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "enabled", + "openaiCredsId", + "botType", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "openaiCredsId", + "botType", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "openaiCredsId": { + "minLength": 1, + "description": "The \"openaiCredsId\" cannot be empty" + }, + "botType": { + "minLength": 1, + "description": "The \"botType\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -64062,7 +71212,45 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "apiKey": { + "type": "string" + } + }, + "required": [ + "name", + "apiKey" + ], + "if": { + "propertyNames": { + "enum": [ + "name", + "apiKey" + ] + } + }, + "then": { + "properties": { + "name": { + "minLength": 1, + "description": "The \"name\" cannot be empty" + }, + "apiKey": { + "minLength": 1, + "description": "The \"apiKey\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -64667,7 +71855,284 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "instanceName": { + "type": "string" + }, + "token": { + "type": "string" + }, + "number": { + "type": "string", + "pattern": "^\\d+[\\.@\\w-]+" + }, + "businessId": { + "type": "string" + }, + "qrcode": { + "type": "boolean" + }, + "Integration": { + "type": "string", + "enum": [ + "WHATSAPP-BUSINESS", + "WHATSAPP-BAILEYS", + "EVOLUTION" + ] + }, + "rejectCall": { + "type": "boolean" + }, + "msgCall": { + "type": "string" + }, + "groupsIgnore": { + "type": "boolean" + }, + "alwaysOnline": { + "type": "boolean" + }, + "readMessages": { + "type": "boolean" + }, + "readStatus": { + "type": "boolean" + }, + "syncFullHistory": { + "type": "boolean" + }, + "wavoipToken": { + "type": "string" + }, + "proxyHost": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyProtocol": { + "type": "string" + }, + "proxyUsername": { + "type": "string" + }, + "proxyPassword": { + "type": "string" + }, + "webhookUrl": { + "type": "string" + }, + "webhookByEvents": { + "type": "boolean" + }, + "webhookBase64": { + "type": "boolean" + }, + "webhookEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "rabbitmqEnabled": { + "type": "boolean" + }, + "rabbitmqEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "natsEnabled": { + "type": "boolean" + }, + "natsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "sqsEnabled": { + "type": "boolean" + }, + "sqsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "chatwootAccountId": { + "type": "string" + }, + "chatwootToken": { + "type": "string" + }, + "chatwootUrl": { + "type": "string" + }, + "chatwootSignMsg": { + "type": "boolean" + }, + "chatwootReopenConversation": { + "type": "boolean" + }, + "chatwootConversationPending": { + "type": "boolean" + }, + "chatwootImportContacts": { + "type": "boolean" + }, + "chatwootNameInbox": { + "type": "string" + }, + "chatwootMergeBrazilContacts": { + "type": "boolean" + }, + "chatwootImportMessages": { + "type": "boolean" + }, + "chatwootDaysLimitImportMessages": { + "type": "number" + } + }, + "if": { + "propertyNames": { + "enum": [ + "instanceName" + ] + } + }, + "then": { + "properties": { + "instanceName": { + "minLength": 1, + "description": "The \"instanceName\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -65511,7 +72976,284 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "instanceName": { + "type": "string" + }, + "token": { + "type": "string" + }, + "number": { + "type": "string", + "pattern": "^\\d+[\\.@\\w-]+" + }, + "businessId": { + "type": "string" + }, + "qrcode": { + "type": "boolean" + }, + "Integration": { + "type": "string", + "enum": [ + "WHATSAPP-BUSINESS", + "WHATSAPP-BAILEYS", + "EVOLUTION" + ] + }, + "rejectCall": { + "type": "boolean" + }, + "msgCall": { + "type": "string" + }, + "groupsIgnore": { + "type": "boolean" + }, + "alwaysOnline": { + "type": "boolean" + }, + "readMessages": { + "type": "boolean" + }, + "readStatus": { + "type": "boolean" + }, + "syncFullHistory": { + "type": "boolean" + }, + "wavoipToken": { + "type": "string" + }, + "proxyHost": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyProtocol": { + "type": "string" + }, + "proxyUsername": { + "type": "string" + }, + "proxyPassword": { + "type": "string" + }, + "webhookUrl": { + "type": "string" + }, + "webhookByEvents": { + "type": "boolean" + }, + "webhookBase64": { + "type": "boolean" + }, + "webhookEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "rabbitmqEnabled": { + "type": "boolean" + }, + "rabbitmqEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "natsEnabled": { + "type": "boolean" + }, + "natsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "sqsEnabled": { + "type": "boolean" + }, + "sqsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "chatwootAccountId": { + "type": "string" + }, + "chatwootToken": { + "type": "string" + }, + "chatwootUrl": { + "type": "string" + }, + "chatwootSignMsg": { + "type": "boolean" + }, + "chatwootReopenConversation": { + "type": "boolean" + }, + "chatwootConversationPending": { + "type": "boolean" + }, + "chatwootImportContacts": { + "type": "boolean" + }, + "chatwootNameInbox": { + "type": "string" + }, + "chatwootMergeBrazilContacts": { + "type": "boolean" + }, + "chatwootImportMessages": { + "type": "boolean" + }, + "chatwootDaysLimitImportMessages": { + "type": "number" + } + }, + "if": { + "propertyNames": { + "enum": [ + "instanceName" + ] + } + }, + "then": { + "properties": { + "instanceName": { + "minLength": 1, + "description": "The \"instanceName\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -68899,7 +76641,49 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "add", + "remove" + ] + } + }, + "required": [ + "remoteJid", + "action" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "action" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "action": { + "minLength": 1, + "description": "The \"action\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -69341,7 +77125,126 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "openaiCredsId": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "speechToText": { + "type": "boolean" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + }, + "openaiIdFallback": { + "type": "string" + } + }, + "required": [ + "openaiCredsId", + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe", + "keepOpen", + "debounceTime", + "ignoreJids" + ], + "if": { + "propertyNames": { + "enum": [ + "openaiCredsId", + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe", + "keepOpen", + "debounceTime", + "ignoreJids" + ] + } + }, + "then": { + "properties": { + "openaiCredsId": { + "minLength": 1, + "description": "The \"openaiCredsId\" cannot be empty" + }, + "expire": { + "minLength": 1, + "description": "The \"expire\" cannot be empty" + }, + "keywordFinish": { + "minLength": 1, + "description": "The \"keywordFinish\" cannot be empty" + }, + "delayMessage": { + "minLength": 1, + "description": "The \"delayMessage\" cannot be empty" + }, + "unknownMessage": { + "minLength": 1, + "description": "The \"unknownMessage\" cannot be empty" + }, + "listeningFromMe": { + "minLength": 1, + "description": "The \"listeningFromMe\" cannot be empty" + }, + "stopBotFromMe": { + "minLength": 1, + "description": "The \"stopBotFromMe\" cannot be empty" + }, + "keepOpen": { + "minLength": 1, + "description": "The \"keepOpen\" cannot be empty" + }, + "debounceTime": { + "minLength": 1, + "description": "The \"debounceTime\" cannot be empty" + }, + "ignoreJids": { + "minLength": 1, + "description": "The \"ignoreJids\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -69892,7 +77795,149 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "openaiCredsId": { + "type": "string" + }, + "botType": { + "type": "string", + "enum": [ + "assistant", + "chatCompletion" + ] + }, + "assistantId": { + "type": "string" + }, + "functionUrl": { + "type": "string" + }, + "model": { + "type": "string" + }, + "systemMessages": { + "type": "array", + "items": { + "type": "string" + } + }, + "assistantMessages": { + "type": "array", + "items": { + "type": "string" + } + }, + "userMessages": { + "type": "array", + "items": { + "type": "string" + } + }, + "maxTokens": { + "type": "integer" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "enabled", + "openaiCredsId", + "botType", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "openaiCredsId", + "botType", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "openaiCredsId": { + "minLength": 1, + "description": "The \"openaiCredsId\" cannot be empty" + }, + "botType": { + "minLength": 1, + "description": "The \"botType\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -70935,7 +78980,73 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "host": { + "type": "string" + }, + "port": { + "type": "string" + }, + "protocol": { + "type": "string" + }, + "username": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "required": [ + "enabled", + "host", + "port", + "protocol" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "host", + "port", + "protocol" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "host": { + "minLength": 1, + "description": "The \"host\" cannot be empty" + }, + "port": { + "minLength": 1, + "description": "The \"port\" cannot be empty" + }, + "protocol": { + "minLength": 1, + "description": "The \"protocol\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -71975,7 +80086,147 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "pusher": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "appId": { + "type": "string" + }, + "key": { + "type": "string" + }, + "secret": { + "type": "string" + }, + "cluster": { + "type": "string" + }, + "useTLS": { + "type": "boolean" + }, + "events": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUPS_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS", + "REMOVE_INSTANCE", + "LOGOUT_INSTANCE", + "INSTANCE_CREATE", + "INSTANCE_DELETE", + "STATUS_INSTANCE", + "CREDS_UPDATE", + "MESSAGING_HISTORY_SET", + "MESSAGING_HISTORY_STATUS", + "LID_MAPPING_UPDATE", + "MESSAGES_MEDIA_UPDATE", + "MESSAGES_REACTION", + "MESSAGE_RECEIPT_UPDATE", + "GROUP_JOIN_REQUEST", + "GROUP_MEMBER_TAG_UPDATE", + "BLOCKLIST_SET", + "BLOCKLIST_UPDATE", + "NEWSLETTER_REACTION", + "NEWSLETTER_VIEW", + "NEWSLETTER_PARTICIPANTS_UPDATE", + "NEWSLETTER_SETTINGS_UPDATE", + "MESSAGE_CAPPING_UPDATE", + "CHATS_LOCK", + "SETTINGS_UPDATE" + ] + } + } + }, + "required": [ + "enabled", + "appId", + "key", + "secret", + "cluster", + "useTLS" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "appId", + "key", + "secret", + "cluster", + "useTLS" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "appId": { + "minLength": 1, + "description": "The \"appId\" cannot be empty" + }, + "key": { + "minLength": 1, + "description": "The \"key\" cannot be empty" + }, + "secret": { + "minLength": 1, + "description": "The \"secret\" cannot be empty" + }, + "cluster": { + "minLength": 1, + "description": "The \"cluster\" cannot be empty" + }, + "useTLS": { + "minLength": 1, + "description": "The \"useTLS\" cannot be empty" + } + } + } + } + }, + "required": [ + "pusher" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -73047,7 +81298,105 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "websocket": { + "$ref": "#/$defs/event" + }, + "rabbitmq": { + "$ref": "#/$defs/event" + }, + "nats": { + "$ref": "#/$defs/event" + }, + "sqs": { + "$ref": "#/$defs/event" + }, + "kafka": { + "$ref": "#/$defs/event" + } + }, + "$defs": { + "event": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "events": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUPS_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS", + "REMOVE_INSTANCE", + "LOGOUT_INSTANCE", + "INSTANCE_CREATE", + "INSTANCE_DELETE", + "STATUS_INSTANCE", + "CREDS_UPDATE", + "MESSAGING_HISTORY_SET", + "MESSAGING_HISTORY_STATUS", + "LID_MAPPING_UPDATE", + "MESSAGES_MEDIA_UPDATE", + "MESSAGES_REACTION", + "MESSAGE_RECEIPT_UPDATE", + "GROUP_JOIN_REQUEST", + "GROUP_MEMBER_TAG_UPDATE", + "BLOCKLIST_SET", + "BLOCKLIST_UPDATE", + "NEWSLETTER_REACTION", + "NEWSLETTER_VIEW", + "NEWSLETTER_PARTICIPANTS_UPDATE", + "NEWSLETTER_SETTINGS_UPDATE", + "MESSAGE_CAPPING_UPDATE", + "CHATS_LOCK", + "SETTINGS_UPDATE" + ] + } + } + }, + "required": [ + "enabled" + ] + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -73468,7 +81817,49 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "messageId": { + "type": "integer" + } + }, + "if": { + "propertyNames": { + "enum": [ + "id", + "type", + "messageId" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + }, + "type": { + "minLength": 1, + "description": "The \"type\" cannot be empty" + }, + "messageId": { + "minLength": 1, + "description": "The \"messageId\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -73827,7 +82218,43 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "pattern": "\\d+", + "minLength": 1 + }, + "expiry": { + "type": "string", + "pattern": "\\d+", + "minLength": 1 + } + }, + "if": { + "propertyNames": { + "enum": [ + "id" + ] + } + }, + "then": { + "properties": { + "id": { + "minLength": 1, + "description": "The \"id\" cannot be empty" + } + } + }, + "required": [ + "id" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -74174,7 +82601,37 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": { + "templateId": { + "type": "string", + "minLength": 1 + }, + "scope": { + "type": "string", + "enum": [ + "instance", + "group", + "contact" + ] + }, + "target": { + "type": "string", + "minLength": 3, + "maxLength": 255 + } + }, + "required": [ + "templateId", + "scope" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -75035,7 +83492,287 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 255 + }, + "settings": { + "type": "object", + "additionalProperties": false, + "properties": { + "localReadTtlSeconds": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "maximum": 2592000 + }, + "localReadTtlOverrides": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "integer", + "minimum": 0, + "maximum": 2592000 + } + }, + "automationSafety": { + "type": [ + "object", + "null" + ], + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "typing": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "minMs": { + "type": "integer", + "minimum": 0, + "maximum": 20000 + }, + "maxMs": { + "type": "integer", + "minimum": 0, + "maximum": 20000 + }, + "charactersPerSecond": { + "type": "number", + "minimum": 1, + "maximum": 100 + }, + "jitterPercent": { + "type": "integer", + "minimum": 0, + "maximum": 25 + }, + "presence": { + "type": "string", + "enum": [ + "composing", + "recording" + ] + }, + "applyToMediaCaptions": { + "type": "boolean" + } + } + }, + "rateLimit": { + "type": "object", + "additionalProperties": false, + "properties": { + "instancePerMinute": { + "type": "integer", + "minimum": 1, + "maximum": 10000 + }, + "instancePerDay": { + "type": "integer", + "minimum": 1, + "maximum": 1000000 + }, + "recipientPerMinute": { + "type": "integer", + "minimum": 1, + "maximum": 1000 + }, + "recipientPerDay": { + "type": "integer", + "minimum": 1, + "maximum": 100000 + }, + "minimumIntervalMs": { + "type": "integer", + "minimum": 0, + "maximum": 600000 + }, + "maxConcurrentSends": { + "type": "integer", + "minimum": 1, + "maximum": 100 + } + } + }, + "outreach": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "newOrDormantRecipientsPerDay": { + "type": "integer", + "minimum": 1, + "maximum": 100000 + }, + "dormantAfterDays": { + "type": "integer", + "minimum": 1, + "maximum": 3650 + } + } + }, + "quietHours": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "start": { + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "end": { + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "timeZone": { + "type": "string", + "minLength": 1, + "maxLength": 100 + } + } + }, + "duplicate": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "windowSeconds": { + "type": "integer", + "minimum": 1, + "maximum": 86400 + }, + "similarityThresholdPercent": { + "type": "integer", + "minimum": 1, + "maximum": 100 + } + } + }, + "suppression": { + "type": "object", + "additionalProperties": false, + "properties": { + "recipients": { + "type": "array", + "maxItems": 10000, + "items": { + "type": "string", + "minLength": 3, + "maxLength": 100 + } + }, + "allowlistEnabled": { + "type": "boolean" + }, + "allowedRecipients": { + "type": "array", + "maxItems": 10000, + "items": { + "type": "string", + "minLength": 3, + "maxLength": 100 + } + } + } + }, + "failurePause": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "threshold": { + "type": "integer", + "minimum": 1, + "maximum": 100 + }, + "pauseSeconds": { + "type": "integer", + "minimum": 1, + "maximum": 86400 + } + } + }, + "audit": { + "type": "object", + "additionalProperties": false, + "properties": { + "retentionDays": { + "type": "integer", + "minimum": 1, + "maximum": 3650 + } + } + } + } + }, + "mistakesGenerator": { + "type": [ + "object", + "null" + ], + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "minLetters": { + "type": "integer", + "minimum": 0, + "maximum": 1000 + }, + "maxLetters": { + "type": "integer", + "minimum": 0, + "maximum": 1000 + }, + "probability": { + "type": "integer", + "minimum": 0, + "maximum": 100 + } + }, + "required": [ + "enabled", + "minLetters", + "maxLetters", + "probability" + ] + } + } + } + }, + "required": [ + "name", + "settings" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -75601,7 +84338,23 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": { + "templateId": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "templateId" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -75910,7 +84663,29 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": { + "templateId": { + "type": "string", + "minLength": 1 + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 255 + } + }, + "required": [ + "templateId", + "name" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -76486,7 +85261,290 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": { + "templateId": { + "type": "string", + "minLength": 1 + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 255 + }, + "settings": { + "type": "object", + "additionalProperties": false, + "properties": { + "localReadTtlSeconds": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "maximum": 2592000 + }, + "localReadTtlOverrides": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "integer", + "minimum": 0, + "maximum": 2592000 + } + }, + "automationSafety": { + "type": [ + "object", + "null" + ], + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "typing": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "minMs": { + "type": "integer", + "minimum": 0, + "maximum": 20000 + }, + "maxMs": { + "type": "integer", + "minimum": 0, + "maximum": 20000 + }, + "charactersPerSecond": { + "type": "number", + "minimum": 1, + "maximum": 100 + }, + "jitterPercent": { + "type": "integer", + "minimum": 0, + "maximum": 25 + }, + "presence": { + "type": "string", + "enum": [ + "composing", + "recording" + ] + }, + "applyToMediaCaptions": { + "type": "boolean" + } + } + }, + "rateLimit": { + "type": "object", + "additionalProperties": false, + "properties": { + "instancePerMinute": { + "type": "integer", + "minimum": 1, + "maximum": 10000 + }, + "instancePerDay": { + "type": "integer", + "minimum": 1, + "maximum": 1000000 + }, + "recipientPerMinute": { + "type": "integer", + "minimum": 1, + "maximum": 1000 + }, + "recipientPerDay": { + "type": "integer", + "minimum": 1, + "maximum": 100000 + }, + "minimumIntervalMs": { + "type": "integer", + "minimum": 0, + "maximum": 600000 + }, + "maxConcurrentSends": { + "type": "integer", + "minimum": 1, + "maximum": 100 + } + } + }, + "outreach": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "newOrDormantRecipientsPerDay": { + "type": "integer", + "minimum": 1, + "maximum": 100000 + }, + "dormantAfterDays": { + "type": "integer", + "minimum": 1, + "maximum": 3650 + } + } + }, + "quietHours": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "start": { + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "end": { + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "timeZone": { + "type": "string", + "minLength": 1, + "maxLength": 100 + } + } + }, + "duplicate": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "windowSeconds": { + "type": "integer", + "minimum": 1, + "maximum": 86400 + }, + "similarityThresholdPercent": { + "type": "integer", + "minimum": 1, + "maximum": 100 + } + } + }, + "suppression": { + "type": "object", + "additionalProperties": false, + "properties": { + "recipients": { + "type": "array", + "maxItems": 10000, + "items": { + "type": "string", + "minLength": 3, + "maxLength": 100 + } + }, + "allowlistEnabled": { + "type": "boolean" + }, + "allowedRecipients": { + "type": "array", + "maxItems": 10000, + "items": { + "type": "string", + "minLength": 3, + "maxLength": 100 + } + } + } + }, + "failurePause": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "threshold": { + "type": "integer", + "minimum": 1, + "maximum": 100 + }, + "pauseSeconds": { + "type": "integer", + "minimum": 1, + "maximum": 86400 + } + } + }, + "audit": { + "type": "object", + "additionalProperties": false, + "properties": { + "retentionDays": { + "type": "integer", + "minimum": 1, + "maximum": 3650 + } + } + } + } + }, + "mistakesGenerator": { + "type": [ + "object", + "null" + ], + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "minLetters": { + "type": "integer", + "minimum": 0, + "maximum": 1000 + }, + "maxLetters": { + "type": "integer", + "minimum": 0, + "maximum": 1000 + }, + "probability": { + "type": "integer", + "minimum": 0, + "maximum": 100 + } + }, + "required": [ + "enabled", + "minLetters", + "maxLetters", + "probability" + ] + } + } + } + }, + "required": [ + "templateId" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -77343,7 +86401,32 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": { + "scope": { + "type": "string", + "enum": [ + "instance", + "group", + "contact" + ] + }, + "target": { + "type": "string", + "minLength": 3, + "maxLength": 255 + } + }, + "required": [ + "scope" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -78570,7 +87653,343 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "rejectCall": { + "type": "boolean" + }, + "msgCall": { + "type": "string" + }, + "groupsIgnore": { + "type": "boolean" + }, + "alwaysOnline": { + "type": "boolean" + }, + "readMessages": { + "type": "boolean" + }, + "readStatus": { + "type": "boolean" + }, + "syncFullHistory": { + "type": "boolean" + }, + "wavoipToken": { + "type": "string" + }, + "localReadTtlSeconds": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "maximum": 2592000 + }, + "localReadTtlOverrides": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "integer", + "minimum": 0, + "maximum": 2592000 + } + }, + "mistakesGenerator": { + "type": [ + "object", + "null" + ], + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "minLetters": { + "type": "integer", + "minimum": 0, + "maximum": 1000 + }, + "maxLetters": { + "type": "integer", + "minimum": 0, + "maximum": 1000 + }, + "probability": { + "type": "integer", + "minimum": 0, + "maximum": 100 + } + }, + "required": [ + "enabled", + "minLetters", + "maxLetters", + "probability" + ] + }, + "automationSafety": { + "type": [ + "object", + "null" + ], + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "typing": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "minMs": { + "type": "integer", + "minimum": 0, + "maximum": 20000 + }, + "maxMs": { + "type": "integer", + "minimum": 0, + "maximum": 20000 + }, + "charactersPerSecond": { + "type": "number", + "minimum": 1, + "maximum": 100 + }, + "jitterPercent": { + "type": "integer", + "minimum": 0, + "maximum": 25 + }, + "presence": { + "type": "string", + "enum": [ + "composing", + "recording" + ] + }, + "applyToMediaCaptions": { + "type": "boolean" + } + } + }, + "rateLimit": { + "type": "object", + "additionalProperties": false, + "properties": { + "instancePerMinute": { + "type": "integer", + "minimum": 1, + "maximum": 10000 + }, + "instancePerDay": { + "type": "integer", + "minimum": 1, + "maximum": 1000000 + }, + "recipientPerMinute": { + "type": "integer", + "minimum": 1, + "maximum": 1000 + }, + "recipientPerDay": { + "type": "integer", + "minimum": 1, + "maximum": 100000 + }, + "minimumIntervalMs": { + "type": "integer", + "minimum": 0, + "maximum": 600000 + }, + "maxConcurrentSends": { + "type": "integer", + "minimum": 1, + "maximum": 100 + } + } + }, + "outreach": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "newOrDormantRecipientsPerDay": { + "type": "integer", + "minimum": 1, + "maximum": 100000 + }, + "dormantAfterDays": { + "type": "integer", + "minimum": 1, + "maximum": 3650 + } + } + }, + "quietHours": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "start": { + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "end": { + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "timeZone": { + "type": "string", + "minLength": 1, + "maxLength": 100 + } + } + }, + "duplicate": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "windowSeconds": { + "type": "integer", + "minimum": 1, + "maximum": 86400 + }, + "similarityThresholdPercent": { + "type": "integer", + "minimum": 1, + "maximum": 100 + } + } + }, + "suppression": { + "type": "object", + "additionalProperties": false, + "properties": { + "recipients": { + "type": "array", + "maxItems": 10000, + "items": { + "type": "string", + "minLength": 3, + "maxLength": 100 + } + }, + "allowlistEnabled": { + "type": "boolean" + }, + "allowedRecipients": { + "type": "array", + "maxItems": 10000, + "items": { + "type": "string", + "minLength": 3, + "maxLength": 100 + } + } + } + }, + "failurePause": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "threshold": { + "type": "integer", + "minimum": 1, + "maximum": 100 + }, + "pauseSeconds": { + "type": "integer", + "minimum": 1, + "maximum": 86400 + } + } + }, + "audit": { + "type": "object", + "additionalProperties": false, + "properties": { + "retentionDays": { + "type": "integer", + "minimum": 1, + "maximum": 3650 + } + } + } + } + } + }, + "required": [ + "rejectCall", + "groupsIgnore", + "alwaysOnline", + "readMessages", + "readStatus", + "syncFullHistory" + ], + "if": { + "propertyNames": { + "enum": [ + "rejectCall", + "groupsIgnore", + "alwaysOnline", + "readMessages", + "readStatus", + "syncFullHistory" + ] + } + }, + "then": { + "properties": { + "rejectCall": { + "minLength": 1, + "description": "The \"rejectCall\" cannot be empty" + }, + "groupsIgnore": { + "minLength": 1, + "description": "The \"groupsIgnore\" cannot be empty" + }, + "alwaysOnline": { + "minLength": 1, + "description": "The \"alwaysOnline\" cannot be empty" + }, + "readMessages": { + "minLength": 1, + "description": "The \"readMessages\" cannot be empty" + }, + "readStatus": { + "minLength": 1, + "description": "The \"readStatus\" cannot be empty" + }, + "syncFullHistory": { + "minLength": 1, + "description": "The \"syncFullHistory\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -79838,7 +89257,105 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "websocket": { + "$ref": "#/$defs/event" + }, + "rabbitmq": { + "$ref": "#/$defs/event" + }, + "nats": { + "$ref": "#/$defs/event" + }, + "sqs": { + "$ref": "#/$defs/event" + }, + "kafka": { + "$ref": "#/$defs/event" + } + }, + "$defs": { + "event": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "events": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUPS_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS", + "REMOVE_INSTANCE", + "LOGOUT_INSTANCE", + "INSTANCE_CREATE", + "INSTANCE_DELETE", + "STATUS_INSTANCE", + "CREDS_UPDATE", + "MESSAGING_HISTORY_SET", + "MESSAGING_HISTORY_STATUS", + "LID_MAPPING_UPDATE", + "MESSAGES_MEDIA_UPDATE", + "MESSAGES_REACTION", + "MESSAGE_RECEIPT_UPDATE", + "GROUP_JOIN_REQUEST", + "GROUP_MEMBER_TAG_UPDATE", + "BLOCKLIST_SET", + "BLOCKLIST_UPDATE", + "NEWSLETTER_REACTION", + "NEWSLETTER_VIEW", + "NEWSLETTER_PARTICIPANTS_UPDATE", + "NEWSLETTER_SETTINGS_UPDATE", + "MESSAGE_CAPPING_UPDATE", + "CHATS_LOCK", + "SETTINGS_UPDATE" + ] + } + } + }, + "required": [ + "enabled" + ] + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -80284,7 +89801,74 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "category": { + "type": "string", + "enum": [ + "AUTHENTICATION", + "MARKETING", + "UTILITY" + ] + }, + "allowCategoryChange": { + "type": "boolean" + }, + "language": { + "type": "string" + }, + "components": { + "type": "array" + }, + "webhookUrl": { + "type": "string" + } + }, + "required": [ + "name", + "category", + "language", + "components" + ], + "if": { + "propertyNames": { + "enum": [ + "name", + "category", + "language", + "components" + ] + } + }, + "then": { + "properties": { + "name": { + "minLength": 1, + "description": "The \"name\" cannot be empty" + }, + "category": { + "minLength": 1, + "description": "The \"category\" cannot be empty" + }, + "language": { + "minLength": 1, + "description": "The \"language\" cannot be empty" + }, + "components": { + "minLength": 1, + "description": "The \"components\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -80664,7 +90248,39 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "hsmId": { + "type": "string" + } + }, + "required": [ + "name" + ], + "if": { + "propertyNames": { + "enum": [ + "name" + ] + } + }, + "then": { + "properties": { + "name": { + "minLength": 1, + "description": "The \"name\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -81023,7 +90639,53 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "templateId": { + "type": "string" + }, + "category": { + "type": "string", + "enum": [ + "AUTHENTICATION", + "MARKETING", + "UTILITY" + ] + }, + "allowCategoryChange": { + "type": "boolean" + }, + "ttl": { + "type": "number" + }, + "components": { + "type": "array" + } + }, + "required": [ + "templateId" + ], + "if": { + "propertyNames": { + "enum": [ + "templateId" + ] + } + }, + "then": { + "properties": { + "templateId": { + "minLength": 1, + "description": "The \"templateId\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -81948,7 +91610,51 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "opened", + "closed", + "paused", + "delete" + ] + } + }, + "required": [ + "remoteJid", + "status" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "status" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "status": { + "minLength": 1, + "description": "The \"status\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -82375,7 +92081,109 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "url": { + "type": "string" + }, + "typebot": { + "type": "string" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "enabled", + "url", + "typebot", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "url", + "typebot", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "url": { + "minLength": 1, + "description": "The \"url\" cannot be empty" + }, + "typebot": { + "minLength": 1, + "description": "The \"typebot\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -83044,7 +92852,284 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "instanceName": { + "type": "string" + }, + "token": { + "type": "string" + }, + "number": { + "type": "string", + "pattern": "^\\d+[\\.@\\w-]+" + }, + "businessId": { + "type": "string" + }, + "qrcode": { + "type": "boolean" + }, + "Integration": { + "type": "string", + "enum": [ + "WHATSAPP-BUSINESS", + "WHATSAPP-BAILEYS", + "EVOLUTION" + ] + }, + "rejectCall": { + "type": "boolean" + }, + "msgCall": { + "type": "string" + }, + "groupsIgnore": { + "type": "boolean" + }, + "alwaysOnline": { + "type": "boolean" + }, + "readMessages": { + "type": "boolean" + }, + "readStatus": { + "type": "boolean" + }, + "syncFullHistory": { + "type": "boolean" + }, + "wavoipToken": { + "type": "string" + }, + "proxyHost": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyProtocol": { + "type": "string" + }, + "proxyUsername": { + "type": "string" + }, + "proxyPassword": { + "type": "string" + }, + "webhookUrl": { + "type": "string" + }, + "webhookByEvents": { + "type": "boolean" + }, + "webhookBase64": { + "type": "boolean" + }, + "webhookEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "rabbitmqEnabled": { + "type": "boolean" + }, + "rabbitmqEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "natsEnabled": { + "type": "boolean" + }, + "natsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "sqsEnabled": { + "type": "boolean" + }, + "sqsEvents": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUP_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS" + ] + } + }, + "chatwootAccountId": { + "type": "string" + }, + "chatwootToken": { + "type": "string" + }, + "chatwootUrl": { + "type": "string" + }, + "chatwootSignMsg": { + "type": "boolean" + }, + "chatwootReopenConversation": { + "type": "boolean" + }, + "chatwootConversationPending": { + "type": "boolean" + }, + "chatwootImportContacts": { + "type": "boolean" + }, + "chatwootNameInbox": { + "type": "string" + }, + "chatwootMergeBrazilContacts": { + "type": "boolean" + }, + "chatwootImportMessages": { + "type": "boolean" + }, + "chatwootDaysLimitImportMessages": { + "type": "number" + } + }, + "if": { + "propertyNames": { + "enum": [ + "instanceName" + ] + } + }, + "then": { + "properties": { + "instanceName": { + "minLength": 1, + "description": "The \"instanceName\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -85878,7 +95963,49 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "add", + "remove" + ] + } + }, + "required": [ + "remoteJid", + "action" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "action" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "action": { + "minLength": 1, + "description": "The \"action\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -86130,167 +96257,256 @@ } }, "example": { - "status": 401, - "error": "Unauthorized", - "message": "Missing or invalid API key." + "status": 401, + "error": "Unauthorized", + "message": "Missing or invalid API key." + } + } + } + }, + "404": { + "description": "Instance or resource not found.", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": true, + "properties": { + "status": { + "type": "integer" + }, + "error": { + "type": "string" + }, + "message": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + }, + "example": { + "status": 404, + "error": "Not Found", + "message": "Resource not found." + } + } + } + }, + "422": { + "description": "Request validation failed.", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": true, + "properties": { + "status": { + "type": "integer" + }, + "error": { + "type": "string" + }, + "message": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + }, + "example": { + "status": 422, + "error": "Unprocessable Entity", + "message": [ + "A required field is missing." + ] + } + } + } + }, + "429": { + "description": "Request rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": true, + "properties": { + "status": { + "type": "integer" + }, + "error": { + "type": "string" + }, + "message": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + }, + "example": { + "status": 429, + "error": "Too Many Requests", + "message": "Request rate limit exceeded." + } + } + } + }, + "500": { + "description": "Unexpected server error.", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": true, + "properties": { + "status": { + "type": "integer" + }, + "error": { + "type": "string" + }, + "message": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + }, + "example": { + "status": 500, + "error": "Internal Server Error", + "message": "Unexpected server error." } } } - }, - "404": { - "description": "Instance or resource not found.", - "content": { - "application/json": { - "schema": { - "type": "object", - "additionalProperties": true, - "properties": { - "status": { - "type": "integer" - }, - "error": { + } + }, + "requestBody": { + "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "keepOpen": { + "type": "boolean" + }, + "debounceTime": { + "type": "integer" + }, + "typebotIdFallback": { + "type": "string" + }, + "ignoreJids": { + "type": "array", + "items": { "type": "string" - }, - "message": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] } } }, - "example": { - "status": 404, - "error": "Not Found", - "message": "Resource not found." - } - } - } - }, - "422": { - "description": "Request validation failed.", - "content": { - "application/json": { - "schema": { - "type": "object", - "additionalProperties": true, - "properties": { - "status": { - "type": "integer" - }, - "error": { - "type": "string" - }, - "message": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - } + "required": [ + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe" + ], + "if": { + "propertyNames": { + "enum": [ + "expire", + "keywordFinish", + "delayMessage", + "unknownMessage", + "listeningFromMe", + "stopBotFromMe" + ] } }, - "example": { - "status": 422, - "error": "Unprocessable Entity", - "message": [ - "A required field is missing." - ] - } - } - } - }, - "429": { - "description": "Request rate limit exceeded.", - "content": { - "application/json": { - "schema": { - "type": "object", - "additionalProperties": true, + "then": { "properties": { - "status": { - "type": "integer" + "expire": { + "minLength": 1, + "description": "The \"expire\" cannot be empty" }, - "error": { - "type": "string" + "keywordFinish": { + "minLength": 1, + "description": "The \"keywordFinish\" cannot be empty" }, - "message": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - } - } - }, - "example": { - "status": 429, - "error": "Too Many Requests", - "message": "Request rate limit exceeded." - } - } - } - }, - "500": { - "description": "Unexpected server error.", - "content": { - "application/json": { - "schema": { - "type": "object", - "additionalProperties": true, - "properties": { - "status": { - "type": "integer" + "delayMessage": { + "minLength": 1, + "description": "The \"delayMessage\" cannot be empty" }, - "error": { - "type": "string" + "unknownMessage": { + "minLength": 1, + "description": "The \"unknownMessage\" cannot be empty" }, - "message": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] + "listeningFromMe": { + "minLength": 1, + "description": "The \"listeningFromMe\" cannot be empty" + }, + "stopBotFromMe": { + "minLength": 1, + "description": "The \"stopBotFromMe\" cannot be empty" } } - }, - "example": { - "status": 500, - "error": "Internal Server Error", - "message": "Unexpected server error." } } - } - } - }, - "requestBody": { - "required": true, - "content": { + }, "application/json": { "schema": { "type": "object", @@ -86707,7 +96923,54 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "remoteJid": { + "type": "string" + }, + "url": { + "type": "string" + }, + "typebot": { + "type": "string" + } + }, + "required": [ + "remoteJid", + "url", + "typebot" + ], + "if": { + "propertyNames": { + "enum": [ + "remoteJid", + "url", + "typebot" + ] + } + }, + "then": { + "properties": { + "remoteJid": { + "minLength": 1, + "description": "The \"remoteJid\" cannot be empty" + }, + "url": { + "minLength": 1, + "description": "The \"url\" cannot be empty" + }, + "typebot": { + "minLength": 1, + "description": "The \"typebot\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -87146,7 +97409,109 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "url": { + "type": "string" + }, + "typebot": { + "type": "string" + }, + "triggerType": { + "type": "string", + "enum": [ + "all", + "keyword", + "none", + "advanced" + ] + }, + "triggerOperator": { + "type": "string", + "enum": [ + "equals", + "contains", + "startsWith", + "endsWith", + "regex" + ] + }, + "triggerValue": { + "type": "string" + }, + "expire": { + "type": "integer" + }, + "keywordFinish": { + "type": "string" + }, + "delayMessage": { + "type": "integer" + }, + "unknownMessage": { + "type": "string" + }, + "listeningFromMe": { + "type": "boolean" + }, + "stopBotFromMe": { + "type": "boolean" + }, + "ignoreJids": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "enabled", + "url", + "typebot", + "triggerType" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "url", + "typebot", + "triggerType" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "url": { + "minLength": 1, + "description": "The \"url\" cannot be empty" + }, + "typebot": { + "minLength": 1, + "description": "The \"typebot\" cannot be empty" + }, + "triggerType": { + "minLength": 1, + "description": "The \"triggerType\" cannot be empty" + } + } + } + } + }, "application/json": { "schema": { "type": "object", @@ -89619,7 +99984,129 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "webhooks": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 100 + }, + "enabled": { + "type": "boolean" + }, + "url": { + "type": "string" + }, + "headers": { + "type": "object" + }, + "byEvents": { + "type": "boolean" + }, + "base64": { + "type": "boolean" + }, + "events": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUPS_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS", + "REMOVE_INSTANCE", + "LOGOUT_INSTANCE", + "INSTANCE_CREATE", + "INSTANCE_DELETE", + "STATUS_INSTANCE", + "CREDS_UPDATE", + "MESSAGING_HISTORY_SET", + "MESSAGING_HISTORY_STATUS", + "LID_MAPPING_UPDATE", + "MESSAGES_MEDIA_UPDATE", + "MESSAGES_REACTION", + "MESSAGE_RECEIPT_UPDATE", + "GROUP_JOIN_REQUEST", + "GROUP_MEMBER_TAG_UPDATE", + "BLOCKLIST_SET", + "BLOCKLIST_UPDATE", + "NEWSLETTER_REACTION", + "NEWSLETTER_VIEW", + "NEWSLETTER_PARTICIPANTS_UPDATE", + "NEWSLETTER_SETTINGS_UPDATE", + "MESSAGE_CAPPING_UPDATE", + "CHATS_LOCK", + "SETTINGS_UPDATE" + ] + } + } + }, + "required": [ + "enabled", + "url" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "url" + ] + } + }, + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" + }, + "url": { + "minLength": 1, + "description": "The \"url\" cannot be empty" + } + } + } + } + } + }, + "required": [ + "webhooks" + ] + } + }, "application/json": { "schema": { "type": "object", @@ -90054,93 +100541,211 @@ } }, "example": { - "status": 422, - "error": "Unprocessable Entity", - "message": [ - "A required field is missing." - ] + "status": 422, + "error": "Unprocessable Entity", + "message": [ + "A required field is missing." + ] + } + } + } + }, + "429": { + "description": "Request rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": true, + "properties": { + "status": { + "type": "integer" + }, + "error": { + "type": "string" + }, + "message": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + }, + "example": { + "status": 429, + "error": "Too Many Requests", + "message": "Request rate limit exceeded." + } + } + } + }, + "500": { + "description": "Unexpected server error.", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": true, + "properties": { + "status": { + "type": "integer" + }, + "error": { + "type": "string" + }, + "message": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + }, + "example": { + "status": 500, + "error": "Internal Server Error", + "message": "Unexpected server error." } } } - }, - "429": { - "description": "Request rate limit exceeded.", - "content": { - "application/json": { - "schema": { - "type": "object", - "additionalProperties": true, - "properties": { - "status": { - "type": "integer" - }, - "error": { - "type": "string" - }, - "message": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } + } + }, + "requestBody": { + "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "webhook": { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 100 + }, + "enabled": { + "type": "boolean" + }, + "url": { + "type": "string" + }, + "headers": { + "type": "object" + }, + "byEvents": { + "type": "boolean" + }, + "base64": { + "type": "boolean" + }, + "events": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUPS_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS", + "REMOVE_INSTANCE", + "LOGOUT_INSTANCE", + "INSTANCE_CREATE", + "INSTANCE_DELETE", + "STATUS_INSTANCE", + "CREDS_UPDATE", + "MESSAGING_HISTORY_SET", + "MESSAGING_HISTORY_STATUS", + "LID_MAPPING_UPDATE", + "MESSAGES_MEDIA_UPDATE", + "MESSAGES_REACTION", + "MESSAGE_RECEIPT_UPDATE", + "GROUP_JOIN_REQUEST", + "GROUP_MEMBER_TAG_UPDATE", + "BLOCKLIST_SET", + "BLOCKLIST_UPDATE", + "NEWSLETTER_REACTION", + "NEWSLETTER_VIEW", + "NEWSLETTER_PARTICIPANTS_UPDATE", + "NEWSLETTER_SETTINGS_UPDATE", + "MESSAGE_CAPPING_UPDATE", + "CHATS_LOCK", + "SETTINGS_UPDATE" + ] } - ] - } - } - }, - "example": { - "status": 429, - "error": "Too Many Requests", - "message": "Request rate limit exceeded." - } - } - } - }, - "500": { - "description": "Unexpected server error.", - "content": { - "application/json": { - "schema": { - "type": "object", - "additionalProperties": true, - "properties": { - "status": { - "type": "integer" + } }, - "error": { - "type": "string" + "required": [ + "enabled", + "url" + ], + "if": { + "propertyNames": { + "enum": [ + "enabled", + "url" + ] + } }, - "message": { - "oneOf": [ - { - "type": "string" + "then": { + "properties": { + "enabled": { + "minLength": 1, + "description": "The \"enabled\" cannot be empty" }, - { - "type": "array", - "items": { - "type": "string" - } + "url": { + "minLength": 1, + "description": "The \"url\" cannot be empty" } - ] + } } } }, - "example": { - "status": 500, - "error": "Internal Server Error", - "message": "Unexpected server error." - } + "required": [ + "webhook" + ] } - } - } - }, - "requestBody": { - "required": true, - "content": { + }, "application/json": { "schema": { "type": "object", @@ -91190,7 +101795,105 @@ }, "requestBody": { "required": true, + "description": "Use the guided form fields, or select application/json for the raw JSON editor.", "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "websocket": { + "$ref": "#/$defs/event" + }, + "rabbitmq": { + "$ref": "#/$defs/event" + }, + "nats": { + "$ref": "#/$defs/event" + }, + "sqs": { + "$ref": "#/$defs/event" + }, + "kafka": { + "$ref": "#/$defs/event" + } + }, + "$defs": { + "event": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "enum": [ + true, + false + ] + }, + "events": { + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "enum": [ + "APPLICATION_STARTUP", + "QRCODE_UPDATED", + "MESSAGES_SET", + "MESSAGES_UPSERT", + "MESSAGES_EDITED", + "MESSAGES_UPDATE", + "MESSAGES_DELETE", + "SEND_MESSAGE", + "SEND_MESSAGE_UPDATE", + "CONTACTS_SET", + "CONTACTS_UPSERT", + "CONTACTS_UPDATE", + "PRESENCE_UPDATE", + "CHATS_SET", + "CHATS_UPSERT", + "CHATS_UPDATE", + "CHATS_DELETE", + "GROUPS_UPSERT", + "GROUPS_UPDATE", + "GROUP_PARTICIPANTS_UPDATE", + "CONNECTION_UPDATE", + "LABELS_EDIT", + "LABELS_ASSOCIATION", + "CALL", + "TYPEBOT_START", + "TYPEBOT_CHANGE_STATUS", + "REMOVE_INSTANCE", + "LOGOUT_INSTANCE", + "INSTANCE_CREATE", + "INSTANCE_DELETE", + "STATUS_INSTANCE", + "CREDS_UPDATE", + "MESSAGING_HISTORY_SET", + "MESSAGING_HISTORY_STATUS", + "LID_MAPPING_UPDATE", + "MESSAGES_MEDIA_UPDATE", + "MESSAGES_REACTION", + "MESSAGE_RECEIPT_UPDATE", + "GROUP_JOIN_REQUEST", + "GROUP_MEMBER_TAG_UPDATE", + "BLOCKLIST_SET", + "BLOCKLIST_UPDATE", + "NEWSLETTER_REACTION", + "NEWSLETTER_VIEW", + "NEWSLETTER_PARTICIPANTS_UPDATE", + "NEWSLETTER_SETTINGS_UPDATE", + "MESSAGE_CAPPING_UPDATE", + "CHATS_LOCK", + "SETTINGS_UPDATE" + ] + } + } + }, + "required": [ + "enabled" + ] + } + } + } + }, "application/json": { "schema": { "type": "object", diff --git a/package-lock.json b/package-lock.json index 8d87d71505..6337301461 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "evolution-api", - "version": "5.4.2", + "version": "5.4.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "evolution-api", - "version": "5.4.2", + "version": "5.4.3", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index c9ab134e49..2244a5909d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "evolution-api", - "version": "5.4.2", + "version": "5.4.3", "description": "Rest api for communication with WhatsApp", "main": "./dist/main.js", "type": "commonjs", @@ -16,6 +16,7 @@ "test:message-archive": "tsx ./test/message-archive.test.ts", "test:outbound-safety": "tsx ./test/outbound-safety.test.ts", "test:outbound-safety:postgres": "tsx ./test/outbound-safety.postgres.test.ts", + "test:delete-message": "tsx ./test/message-key.test.ts", "lint": "eslint --fix --ext .ts src", "lint:check": "eslint --ext .ts src", "generate:baileys-api": "node scripts/generate-baileys-openapi.mjs", diff --git a/scripts/audit-runtime-openapi.mjs b/scripts/audit-runtime-openapi.mjs index b06a068d08..23970bdd10 100644 --- a/scripts/audit-runtime-openapi.mjs +++ b/scripts/audit-runtime-openapi.mjs @@ -80,6 +80,13 @@ for (const route of routes) { const operation = paths[route.path][route.method]; if (['post', 'put', 'patch'].includes(route.method) && !operation.requestBody) contractFailures.push(`${route.method} ${route.path}: missing exact request body`); + if (route.schema && route.method !== 'get' && !route.multipart) { + const content = operation.requestBody?.content ?? {}; + if (!content['application/x-www-form-urlencoded']?.schema) + contractFailures.push(`${route.method} ${route.path}: missing guided form body`); + if (!content['application/json']?.schema) + contractFailures.push(`${route.method} ${route.path}: missing raw JSON fallback`); + } for (const code of ['400', '401', '404', '422', '429', '500']) if (!operation.responses?.[code]?.content) contractFailures.push(`${route.method} ${route.path}: missing ${code} error schema/example`); diff --git a/scripts/runtime-openapi-conventions.mjs b/scripts/runtime-openapi-conventions.mjs index 484ef5da1f..08dc61b35d 100644 --- a/scripts/runtime-openapi-conventions.mjs +++ b/scripts/runtime-openapi-conventions.mjs @@ -35,6 +35,14 @@ const words = (value) => .replace(/[-_]/g, ' ') .trim(); const title = (value) => words(value).replace(/\b\w/g, (letter) => letter.toUpperCase()); +const guidedBodyContent = (schema) => ({ + 'application/x-www-form-urlencoded': { + schema, + }, + 'application/json': { + schema, + }, +}); const actionVerb = (method, action) => { if (/^(find|fetch|get|list|connection)/i.test(action)) return 'Get'; @@ -168,7 +176,17 @@ export const runtimeOperation = ({ method, path, source, schemaName, schema, mul const requestSchema = multipart ? { ...schema, properties: { ...(schema.properties ?? {}), file: { type: 'string', format: 'binary' } } } : schema; - operation.requestBody = { required: true, content: { [contentType]: { schema: requestSchema } } }; + operation.requestBody = { + required: true, + description: + contentType === 'application/json' + ? 'Use the guided form fields, or select application/json for the raw JSON editor.' + : undefined, + content: + contentType === 'application/json' + ? guidedBodyContent(requestSchema) + : { [contentType]: { schema: requestSchema } }, + }; } else if (bodyMethods.has(method) && path === '/webhook/evolution') { operation.requestBody = { required: true, diff --git a/scripts/runtime-openapi-overrides.mjs b/scripts/runtime-openapi-overrides.mjs index 73d8495c77..840f3bb266 100644 --- a/scripts/runtime-openapi-overrides.mjs +++ b/scripts/runtime-openapi-overrides.mjs @@ -8,9 +8,19 @@ const params = (properties, required = []) => required: required.includes(name), schema, })); +const bodySchema = (properties, required = []) => ({ + type: 'object', + additionalProperties: false, + properties, + required, +}); const body = (properties, required = []) => ({ required: true, - content: { 'application/json': { schema: { type: 'object', additionalProperties: false, properties, required } } }, + description: 'Use the guided form fields, or select application/json for the raw JSON editor.', + content: { + 'application/x-www-form-urlencoded': { schema: bodySchema(properties, required) }, + 'application/json': { schema: bodySchema(properties, required) }, + }, }); const limit = { ...integer, minimum: 1, maximum: 1000 }; const eventsQuery = { @@ -95,6 +105,11 @@ export const overrides = { ['message'], ), }, + 'delete /chat/deleteMessageForEveryone/{instanceName}': { + summary: 'Delete message with maximum permitted scope', + description: + 'Automatically deletes for everyone when WhatsApp permits it and otherwise deletes for the connected account. The response identifies the applied EVERYONE or ME scope.', + }, 'get /chat/findChatByRemoteJid/{instanceName}': { parameters: params({ remoteJid: string }, ['remoteJid']) }, 'post /instance/restart/{instanceName}': { requestBody: body({}) }, 'get /instance/connect/{instanceName}': { parameters: params({ number: string }) }, diff --git a/src/api/abstract/abstract.router.ts b/src/api/abstract/abstract.router.ts index e28a0e18b6..2ab710a11e 100644 --- a/src/api/abstract/abstract.router.ts +++ b/src/api/abstract/abstract.router.ts @@ -4,6 +4,7 @@ import { GetParticipant, GroupInvite } from '@api/dto/group.dto'; import { InstanceDto } from '@api/dto/instance.dto'; import { Logger } from '@config/logger.config'; import { BadRequestException } from '@exceptions'; +import { coerceFormValue } from '@utils/coerceFormBody'; import { Request } from 'express'; import { JSONSchema7 } from 'json-schema'; import { validate } from 'jsonschema'; @@ -30,7 +31,7 @@ export abstract class RouterBroker { const { request, schema, ClassRef, execute } = args; const ref = new ClassRef(); - const body = request.body; + const body = request.is('application/x-www-form-urlencoded') ? coerceFormValue(request.body, schema) : request.body; const instance = request.params as unknown as InstanceDto; if (request?.query && Object.keys(request.query).length > 0) { diff --git a/src/api/dto/chat.dto.ts b/src/api/dto/chat.dto.ts index 39cc3c5311..a31d9ce2b2 100644 --- a/src/api/dto/chat.dto.ts +++ b/src/api/dto/chat.dto.ts @@ -102,7 +102,10 @@ export class PrivacySettingDto { groupadd: WAPrivacyGroupAddValue; } -export class DeleteMessage extends Key {} +export class DeleteMessage extends Key { + messageTimestamp?: number; + deleteMedia?: boolean; +} export class Options { delay?: number; presence?: WAPresence; diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index b0faea4acc..ce0e3ca191 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -71,6 +71,7 @@ import { buildDeleteMessageKey, preserveMessageKey, resolveDeleteMessageOwnership, + resolveMaximumDeleteScope, } from '@api/services/message-key.service'; import { applyMistakesToMessage } from '@api/services/mistakes-generator.service'; import { OutboundSafetyService } from '@api/services/outbound-safety.service'; @@ -93,8 +94,6 @@ import { } from '@config/env.config'; import { BadRequestException, - ForbiddenException, - GatewayTimeoutException, InternalServerErrorException, NotFoundException, TooManyRequestsException, @@ -4237,21 +4236,102 @@ export class BaileysStartupService extends ChannelStartupService { }); } const deletingAnotherUsersMessage = deleteKey.fromMe === false; - if (deletingAnotherUsersMessage && !isJidGroup(deleteKey.remoteJid)) { - throw new BadRequestException({ - code: 'CANNOT_REVOKE_INCOMING_DIRECT_MESSAGE', - message: - 'WhatsApp does not allow deleting another user’s direct message for everyone. Use deleteMessageForEveryone only for messages sent by this account, or for group messages when this account is an admin.', - }); - } - if (deletingAnotherUsersMessage && !deleteKey.participant) { - throw new BadRequestException({ - code: 'GROUP_DELETE_PARTICIPANT_REQUIRED', - message: - 'Deleting another participant’s group message requires the original participant JID. Enable message storage or send participant from the webhook message key.', + const target = detectedFromMe ? 'CONNECTED_ACCOUNT_MESSAGE' : 'OTHER_PARTICIPANT_MESSAGE'; + + const persistDeletedMessage = async (scope: 'EVERYONE' | 'ME', responseKey = deleteKey) => { + if (!storedMessage) return; + const isLogicalDeleted = configService.get('DATABASE').DELETE_DATA.LOGICAL_MESSAGE_DELETE; + let message = storedMessage; + if (isLogicalDeleted) { + const existingKey = typeof message.key === 'object' && message.key !== null ? message.key : {}; + message = await this.prismaRepository.message.update({ + where: { id: message.id }, + data: { key: { ...existingKey, deleted: true, deletionScope: scope }, status: 'DELETED' }, + }); + if (this.configService.get('DATABASE').SAVE_DATA.MESSAGE_UPDATE) { + const messageUpdate: any = { + messageId: message.id, + keyId: deleteKey.id, + remoteJid: responseKey.remoteJid, + fromMe: responseKey.fromMe, + participant: responseKey.participant, + status: 'DELETED', + instanceId: this.instanceId, + }; + await this.prismaRepository.messageUpdate.create({ data: messageUpdate }); + } + } else { + await this.prismaRepository.message.deleteMany({ where: { id: message.id } }); + } + this.sendDataWebhook(Events.MESSAGES_DELETE, { + id: message.id, + instanceId: message.instanceId, + key: message.key, + messageType: message.messageType, + status: 'DELETED', + deletionScope: scope, + source: message.source, + messageTimestamp: message.messageTimestamp, + pushName: message.pushName, + participant: message.participant, + message: message.message, }); - } - if (deletingAnotherUsersMessage) { + }; + + const deleteForMe = async ( + fallbackReason?: + | 'INCOMING_DIRECT_MESSAGE' + | 'GROUP_ADMIN_REQUIRED' + | 'GROUP_PARTICIPANT_REQUIRED' + | 'EVERYONE_NOT_CONFIRMED', + everyoneAttempted = false, + ) => { + const rawTimestamp = del.messageTimestamp ?? storedMessage?.messageTimestamp; + const numericTimestamp = Number(rawTimestamp); + if (!Number.isFinite(numericTimestamp) || numericTimestamp <= 0) { + throw new BadRequestException({ + code: 'DELETE_FOR_ME_TIMESTAMP_REQUIRED', + message: + 'Delete for me requires the original messageTimestamp. Enable message storage or send messageTimestamp from the messages.upsert webhook.', + id: del.id, + remoteJid: del.remoteJid, + }); + } + const timestampSeconds = Math.floor( + numericTimestamp > 10_000_000_000 ? numericTimestamp / 1000 : numericTimestamp, + ); + await this.client.chatModify( + { + deleteForMe: { + deleteMedia: del.deleteMedia ?? true, + key: deleteKey, + timestamp: timestampSeconds, + }, + }, + deleteKey.remoteJid, + ); + await persistDeletedMessage('ME'); + return { + key: deleteKey, + status: 'APP_STATE_PATCH_ACCEPTED', + deletion: { + requestedMessageId: del.id, + scope: 'ME', + target, + ownershipSource, + ...(fallbackReason ? { fallbackReason } : {}), + submitted: true, + appStatePatchAccepted: true, + serverAcknowledged: false, + everyoneAttempted, + everyoneConfirmed: false, + status: 'APP_STATE_PATCH_ACCEPTED', + }, + }; + }; + + let connectedAccountIsGroupAdmin: boolean | undefined; + if (deletingAnotherUsersMessage && isJidGroup(deleteKey.remoteJid)) { try { const metadata = await this.client.groupMetadata(deleteKey.remoteJid); const ownJids = [this.instance.wuid, this.client.user?.id, this.client.user?.lid] @@ -4263,21 +4343,28 @@ export class BaileysStartupService extends ChannelStartupService { .map((jid) => jidNormalizedUser(jid)) .some((jid) => ownJids.includes(jid)), ); - if (ownParticipant && !ownParticipant.isAdmin && !ownParticipant.isSuperAdmin && !ownParticipant.admin) { - throw new ForbiddenException({ - code: 'GROUP_ADMIN_REQUIRED', - message: 'The connected WhatsApp account must be a group admin to delete another participant’s message.', - remoteJid: deleteKey.remoteJid, - }); + if (ownParticipant) { + connectedAccountIsGroupAdmin = Boolean( + ownParticipant.isAdmin || ownParticipant.isSuperAdmin || ownParticipant.admin, + ); } } catch (error) { - if (error?.status) throw error; this.logger.warn( `Could not verify group-admin permissions before deleting message ${del.id}: ${error?.message ?? error}`, ); } } + const scopeResolution = resolveMaximumDeleteScope( + detectedFromMe, + isJidGroup(deleteKey.remoteJid), + connectedAccountIsGroupAdmin, + ); + if (scopeResolution.scope === 'ME') return deleteForMe(scopeResolution.fallbackReason); + if (deletingAnotherUsersMessage && !deleteKey.participant) { + return deleteForMe('GROUP_PARTICIPANT_REQUIRED'); + } + const revokeMessageId = generateMessageIDV2(this.client.user?.id); let acknowledgedStatus: number | undefined; const waitForMessageUpdate = bindWaitForEvent(this.client.ev, 'messages.update'); @@ -4307,79 +4394,45 @@ export class BaileysStartupService extends ChannelStartupService { (error) => ({ acknowledged: false as const, error }), ); - const response = await this.client.sendMessage( - deleteKey.remoteJid, - { delete: deleteKey }, - { messageId: revokeMessageId }, - ); + let response; + try { + response = await this.client.sendMessage( + deleteKey.remoteJid, + { delete: deleteKey }, + { messageId: revokeMessageId }, + ); + } catch (error) { + this.logger.warn( + `Delete-for-everyone request failed for ${del.id}; falling back to delete-for-me: ${error?.message ?? error}`, + ); + return deleteForMe('EVERYONE_NOT_CONFIRMED', true); + } const acknowledgementResult = await acknowledgement; if (!acknowledgementResult.acknowledged) { - throw new GatewayTimeoutException({ - code: 'DELETE_NOT_ACKNOWLEDGED', - message: - 'WhatsApp did not acknowledge the revoke request within 10 seconds. The local message was not marked as deleted.', - id: del.id, - remoteJid: del.remoteJid, - }); - } - if (response) { - const messageId = deleteKey.id; - if (messageId) { - const isLogicalDeleted = configService.get('DATABASE').DELETE_DATA.LOGICAL_MESSAGE_DELETE; - let message = storedMessage; - if (isLogicalDeleted) { - if (!message) return response; - const existingKey = typeof message?.key === 'object' && message.key !== null ? message.key : {}; - message = await this.prismaRepository.message.update({ - where: { id: message.id }, - data: { key: { ...existingKey, deleted: true }, status: 'DELETED' }, - }); - if (this.configService.get('DATABASE').SAVE_DATA.MESSAGE_UPDATE) { - const messageUpdate: any = { - messageId: message.id, - keyId: messageId, - remoteJid: response.key.remoteJid, - fromMe: response.key.fromMe, - participant: response.key?.participant, - status: 'DELETED', - instanceId: this.instanceId, - }; - await this.prismaRepository.messageUpdate.create({ data: messageUpdate }); - } - } else { - if (!message) return response; - await this.prismaRepository.message.deleteMany({ where: { id: message.id } }); - } - this.sendDataWebhook(Events.MESSAGES_DELETE, { - id: message.id, - instanceId: message.instanceId, - key: message.key, - messageType: message.messageType, - status: 'DELETED', - source: message.source, - messageTimestamp: message.messageTimestamp, - pushName: message.pushName, - participant: message.participant, - message: message.message, - }); - } + this.logger.warn(`Delete-for-everyone was not acknowledged for ${del.id}; falling back to delete-for-me.`); + return deleteForMe('EVERYONE_NOT_CONFIRMED', true); } + await persistDeletedMessage('EVERYONE', response?.key ?? deleteKey); return { ...response, status: acknowledgedStatus ?? WAMessageStatus.SERVER_ACK, deletion: { requestedMessageId: del.id, - target: detectedFromMe ? 'CONNECTED_ACCOUNT_MESSAGE' : 'GROUP_PARTICIPANT_MESSAGE', + scope: 'EVERYONE', + target, ownershipSource, submitted: true, + appStatePatchAccepted: false, serverAcknowledged: true, + everyoneAttempted: true, + everyoneConfirmed: true, status: status[acknowledgedStatus ?? WAMessageStatus.SERVER_ACK], }, }; } catch (error) { if (error?.status) throw error; - throw new InternalServerErrorException('Error while deleting message for everyone', error?.toString()); + throw new InternalServerErrorException('Error while deleting message', error?.toString()); } } diff --git a/src/api/services/message-key.service.ts b/src/api/services/message-key.service.ts index c88bd840b3..b76d303d4a 100644 --- a/src/api/services/message-key.service.ts +++ b/src/api/services/message-key.service.ts @@ -12,6 +12,35 @@ export type DeleteOwnershipSource = | 'INFERRED_CONNECTED_ACCOUNT' | 'INFERRED_GROUP_PARTICIPANT'; +export type ResolvedDeleteScope = 'EVERYONE' | 'ME'; + +export type DeleteScopeResolution = { + scope: ResolvedDeleteScope; + fallbackReason?: + | 'INCOMING_DIRECT_MESSAGE' + | 'GROUP_ADMIN_REQUIRED' + | 'GROUP_PARTICIPANT_REQUIRED' + | 'EVERYONE_NOT_CONFIRMED'; +}; + +/** + * Select the strongest delete scope that WhatsApp permits for the original + * message. An unknown group-admin state intentionally keeps the revoke path: + * the caller can try it and require a real server acknowledgement. + */ +export function resolveMaximumDeleteScope( + fromMe: boolean, + isGroup: boolean, + connectedAccountIsGroupAdmin?: boolean, +): DeleteScopeResolution { + if (fromMe) return { scope: 'EVERYONE' }; + if (!isGroup) return { scope: 'ME', fallbackReason: 'INCOMING_DIRECT_MESSAGE' }; + if (connectedAccountIsGroupAdmin === false) { + return { scope: 'ME', fallbackReason: 'GROUP_ADMIN_REQUIRED' }; + } + return { scope: 'EVERYONE' }; +} + export function resolveDeleteMessageOwnership( requested: MessageKeyLike, stored?: MessageKeyLike | null, diff --git a/src/utils/coerceFormBody.ts b/src/utils/coerceFormBody.ts new file mode 100644 index 0000000000..6a8f27182d --- /dev/null +++ b/src/utils/coerceFormBody.ts @@ -0,0 +1,46 @@ +import { JSONSchema7 } from 'json-schema'; + +const schemaType = (schema: JSONSchema7) => + Array.isArray(schema.type) ? schema.type.find((type) => type !== 'null') : schema.type; + +/** Convert Swagger's guided URL-encoded controls back to JSON-compatible types. */ +export const coerceFormValue = (value: unknown, schema: JSONSchema7): unknown => { + if (value === undefined || value === null) return value; + const type = schemaType(schema); + if (type === 'boolean' && typeof value === 'string') { + if (value === 'true') return true; + if (value === 'false') return false; + } + if ((type === 'integer' || type === 'number') && typeof value === 'string' && value.trim() !== '') { + const number = Number(value); + if (Number.isFinite(number)) return type === 'integer' ? Math.trunc(number) : number; + } + if (type === 'object') { + let objectValue = value; + if (typeof value === 'string') { + try { + objectValue = JSON.parse(value); + } catch { + return value; + } + } + if (objectValue && typeof objectValue === 'object' && !Array.isArray(objectValue)) { + const result = { ...(objectValue as Record) }; + const required = new Set(schema.required ?? []); + for (const [name, propertySchema] of Object.entries(schema.properties ?? {})) { + if (result[name] === '' && !required.has(name)) { + delete result[name]; + } else if (typeof propertySchema === 'object') { + result[name] = coerceFormValue(result[name], propertySchema); + } + } + return result; + } + } + if (type === 'array') { + const values = Array.isArray(value) ? value : [value]; + const itemSchema = typeof schema.items === 'object' && !Array.isArray(schema.items) ? schema.items : undefined; + return itemSchema ? values.map((item) => coerceFormValue(item, itemSchema)) : values; + } + return value; +}; diff --git a/src/validate/chat.schema.ts b/src/validate/chat.schema.ts index 696818e7e1..3d47cbb6d5 100644 --- a/src/validate/chat.schema.ts +++ b/src/validate/chat.schema.ts @@ -123,27 +123,32 @@ export const deleteMessageSchema: JSONSchema7 = { type: 'object', properties: { id: { type: 'string' }, - fromMe: { - type: 'boolean', - enum: [true, false], - description: - 'Optional ownership override. Omit it to detect ownership from the archived original message. True means the connected account sent it; false selects admin deletion for another participant’s group message.', - }, remoteJid: { type: 'string', pattern: '^(?:\\d+@(?:s\\.whatsapp\\.net|lid)|\\d+-\\d+@g\\.us|status@broadcast|[^@\\s]+@broadcast)$', - description: 'remoteJid must be a full WhatsApp JID, not an internal database row ID.', + description: + 'Exact remoteJid from the original message key. For group messages this must be the group JID ending in @g.us, not participant, participantAlt, sender, or an internal database row ID.', }, - remoteJidAlt: { type: 'string' }, participant: { type: 'string', - description: 'Original group participant JID from the webhook message key. Required for admin deletion.', + description: + 'Original group participant JID from the webhook message key. It enables delete-for-everyone for another participant’s group message; when unavailable the operation falls back to delete-for-me.', }, participantAlt: { type: 'string', description: 'Alternate participant JID from the webhook message key, used as a fallback for LID/PN resolution.', }, - addressingMode: { type: 'string', enum: ['lid', 'pn'] }, + messageTimestamp: { + type: 'integer', + minimum: 1, + description: + 'Original Unix timestamp in seconds. Required for delete-for-me only when the original message is unavailable in Evolution message storage.', + }, + deleteMedia: { + type: 'boolean', + default: true, + description: 'Also remove locally stored message media when the selected scope is delete-for-me.', + }, }, required: ['id', 'remoteJid'], ...isNotEmpty('id', 'remoteJid'), diff --git a/test/message-key.test.ts b/test/message-key.test.ts index c2915cf8e7..6cec492ea3 100644 --- a/test/message-key.test.ts +++ b/test/message-key.test.ts @@ -4,8 +4,10 @@ import { buildDeleteMessageKey, hydrateMessageKey, preserveMessageKey, + resolveMaximumDeleteScope, resolveDeleteMessageOwnership, } from '../src/api/services/message-key.service'; +import { coerceFormValue } from '../src/utils/coerceFormBody'; const groupLidKey = { id: '3EB0A_MESSAGE', @@ -32,8 +34,6 @@ const directLidKey = { }; assert.deepEqual(preserveMessageKey(directLidKey), directLidKey); -console.log('message key tests passed'); - const partialGroupDelete = { id: '3EB0A_MESSAGE', fromMe: false, @@ -85,3 +85,51 @@ assert.equal( ).source, 'ARCHIVED_MESSAGE_KEY', ); + +assert.deepEqual(resolveMaximumDeleteScope(false, false), { + scope: 'ME', + fallbackReason: 'INCOMING_DIRECT_MESSAGE', +}); +assert.deepEqual(resolveMaximumDeleteScope(false, true, true), { scope: 'EVERYONE' }); +assert.deepEqual(resolveMaximumDeleteScope(false, true, false), { + scope: 'ME', + fallbackReason: 'GROUP_ADMIN_REQUIRED', +}); +assert.deepEqual(resolveMaximumDeleteScope(true, false), { scope: 'EVERYONE' }); + +assert.deepEqual( + coerceFormValue( + { + id: 'message-id', + enabled: 'false', + timestamp: '1790062631', + tags: ['1', '2'], + nested: '{"count":"2.5","active":"true"}', + optional: '', + }, + { + type: 'object', + required: ['id'], + properties: { + id: { type: 'string' }, + enabled: { type: 'boolean' }, + timestamp: { type: 'integer' }, + tags: { type: 'array', items: { type: 'integer' } }, + nested: { + type: 'object', + properties: { count: { type: 'number' }, active: { type: 'boolean' } }, + }, + optional: { type: 'string' }, + }, + }, + ), + { + id: 'message-id', + enabled: false, + timestamp: 1790062631, + tags: [1, 2], + nested: { count: 2.5, active: true }, + }, +); + +console.log('message deletion and guided form tests passed');