diff --git a/Packs/Zoom/Integrations/Zoom/README.md b/Packs/Zoom/Integrations/Zoom/README.md index 1f3b1fe50c5f..71578e0f0cd4 100644 --- a/Packs/Zoom/Integrations/Zoom/README.md +++ b/Packs/Zoom/Integrations/Zoom/README.md @@ -1605,14 +1605,8 @@ Sends chat messages on Zoom to either an individual user who is in your contact | **Argument Name** | **Description** | **Required** | | --- | --- | --- | | user_id | Unique identifier of the user. | Required | -| at_contact | This field is required if the value of at_type field is set to 1. Email address of the contact. | Optional | -| at_type | The type of mention. You can use one of the following values: 1: Mention a contact. 2: Mention "all" to notify everyone in the channel. | Optional | -| end_position | The end position of the mention. | Optional | -| start_position | The start position of the mention("@") in the message string. | Optional | -| rt_start_position | The start position of the rich text in the message string. | Optional | -| rt_end_position | The end position of the rich text. | Optional | -| format_type | The type of rich text. There is some special logic which is the same as on the Zoom client. 1. AddLink's position can not cross multi lines. 2. A BulletedList will clear the formatting of a NumberedList, Quote, or LeftIndent after it. 3. Likewise, a NumberedList will clear the formatting of a BulletedList, Quote, or LeftIndent after it. 4. Only AddLink, NumberedList and BulletedList can apply to a message which already applied a Quote. 5. A Quote will clear the formatting of all styles after it except AddLink, NumberedList, BulletedList, or Italic. 6. An AddLink will clear the formatting of BackgroundColor, FontColor, or Underline after it. 7. BackgroundColor, FontColor and Underline can not apply to a message which already applied AddLink. 8. BulletedList, NumberedList, LeftIndent, Paragraph, and Quote will automatically expand to apply to the whole line. Possible values are: FontSize, FontColor, BackgroundColor, LeftIndent, Paragraph, AddLink. | Optional | -| format_attr | This field is required if the value of the format_type field is listed below: 1.FontSize value: s for small, m for medium, or l for large font size. 2.FontColor and BackgroundColor value: only supports RGB value. For example: FFC0CB 3.LeftIndent value: a positive pixel length. 4.Paragraph value: h1 for Heading 1, h2 for Heading 2, or h3 for Heading 3. 5.AddLink value: must be a valid URL, with an http or https prefix. For example: . | Optional | +| at_contact | Email address of the mention contact. | Optional | +| is_markdown | if a markdown message provide in the message argument| Optional | message | The message to be sent. Maximum of 1024 characters. | Required | | entry_ids | A list of the file IDs to send. This field only accepts a maximum of six file IDs. | Optional | | reply_main_message_id | The reply message's ID. This field only returns if the message is a reply message. | Optional | diff --git a/Packs/Zoom/Integrations/Zoom/Zoom.py b/Packs/Zoom/Integrations/Zoom/Zoom.py index 481dfe854b48..3b13bc9575bf 100644 --- a/Packs/Zoom/Integrations/Zoom/Zoom.py +++ b/Packs/Zoom/Integrations/Zoom/Zoom.py @@ -1130,7 +1130,7 @@ def zoom_send_file_command(client, **args) -> CommandResults: message_id = upload_response.get('id') return CommandResults( - readable_output=f'Message with id {message_id} was successfully sent' + readable_output=f'Message with id {message_id} was successfully sent' ) @@ -1367,14 +1367,7 @@ def zoom_send_message_command(client, **args) -> CommandResults: """ client = client at_contact = args.get('at_contact') - at_type = AT_TYPE.get(args.get('at_type', None)) user_id = args.get('user_id') - end_position = arg_to_number(args.get('end_position')) - start_position = arg_to_number(args.get('start_position')) - rt_start_position = arg_to_number(args.get('rt_start_position')) - rt_end_position = arg_to_number(args.get('rt_end_position')) - format_type = args.get('format_type') - format_attr = args.get('format_attr') message = args.get('message', '') entry_ids = argToList(args.get('entry_ids', [])) reply_main_message_id = args.get('reply_main_message_id') @@ -1394,10 +1387,6 @@ def zoom_send_message_command(client, **args) -> CommandResults: zoom_file_id.append(res.get('id')) # check if the text contain markdown to parse and also provide text style arguments - if is_markdown and (start_position or end_position - or format_attr or format_type or rt_end_position or rt_start_position or at_type): - raise DemistoException(MARKDOWN_AND_EXTRA_ARGUMENTS) - if is_markdown: # check if text have more then 1 mention if message.count('@') > 1 and at_contact: @@ -1407,18 +1396,7 @@ def zoom_send_message_command(client, **args) -> CommandResults: json_data_all.update({"file_ids": zoom_file_id, "reply_main_message_id": reply_main_message_id, "to_channel": to_channel, "to_contact": to_contact}) else: - json_data_all = {"at_items": [ - { - "at_contact": at_contact, - "at_type": at_type, - "end_position": end_position, - "start_position": start_position - }], - "rich_text": - [{"start_position": rt_start_position, - "end_position": rt_end_position, - "format_type": format_type, - "format_attr": format_attr}], + json_data_all = { "message": message, "file_ids": zoom_file_id, "reply_main_message_id": reply_main_message_id, @@ -1548,7 +1526,12 @@ def zoom_list_messages_command(client, **args) -> CommandResults: search_key = args.get('search_key') exclude_child_message = args.get('exclude_child_message', False) limit = arg_to_number(args.get('limit', 50)) - page_size = limit if limit and limit <= 50 else 50 + page_size = arg_to_number(args.get('page_size')) + + if limit and page_size and limit != 50: + raise DemistoException(LIMIT_AND_EXTRA_ARGUMENTS) + else: + limit = page_size if page_size else limit if not to_contact and not to_channel: raise DemistoException(MISSING_ARGUMENT) @@ -1572,8 +1555,9 @@ def zoom_list_messages_command(client, **args) -> CommandResults: search_key=search_key, exclude_child_message=exclude_child_message, next_page_token=next_page_token, - page_size=page_size) + page_size=limit) data = raw_data.get('messages', []) + if limit and len(all_messages) + len(data) > limit: remaining_limit = limit - len(all_messages) data = data[:remaining_limit] diff --git a/Packs/Zoom/Integrations/Zoom/Zoom.yml b/Packs/Zoom/Integrations/Zoom/Zoom.yml index c84e06952654..5caa9de207b0 100644 --- a/Packs/Zoom/Integrations/Zoom/Zoom.yml +++ b/Packs/Zoom/Integrations/Zoom/Zoom.yml @@ -846,7 +846,7 @@ script: Sends chat messages on Zoom to either an individual user who is in your contact list or to a channel of which you are a member. Use the command zoom-list-users to get the user id by the user email (for to_contact). Use the command zoom-list-user-channels in order to fetch the channel ID by the channel name (for to_channel). In order to send a message, you need to provide at least a message (message text) and to_contact (contact to send) or to_channel (channel to send to), but not both of them. - In order to send a style message you need to provide is-markdown=true and not provide any format_type or format_attr. + In order to send a style message you need to provide is-markdown=true and the message can contain a markdown format If you are using mention markdown in a message, provide the email address in the at_contact argument. arguments: - name: user_id @@ -855,19 +855,8 @@ script: required: true - name: at_contact description: > - This field is required if the value of at_type field is set to 1. - Email address of the contact. + Email address of the mention contact. type: string - - name: at_type - description: > - The type of mention. You can use one of the following values: - 1: Mention a contact. - 2: Mention "all" to notify everyone in the channel. - type: string - auto: PREDEFINED - predefined: - - Mention a contact - - Mention "all" to notify everyone in the channel - name: is_markdown auto: PREDEFINED predefined: @@ -875,7 +864,7 @@ script: - "false" defaultValue: false description: |- - You can provide a markdown message without any other arguments like format type,format attr,start and end position and rt start and end_position + You can provide a markdown message in the message argument. | Element | Markdown Syntax | |------------|-------------------| | Paragraph | # H1 , ## H2 ,### H3| @@ -885,43 +874,10 @@ script: | FontSize | [s|m|l](text)| | BackgroundColor| [#bg](text)| | Mention | @ if mention is not @all please provide argument at_contact= email| - - - name: end_position - description: The end position of the mention. - type: string - - name: start_position - description: The start position of the mention ("@") in the message string. - type: string - - name: rt_start_position - description: The start position of the rich text in the message string. - type: string - - name: rt_end_position - description: The end position of the rich text. - type: string - - name: format_type - description: The type of rich text. There is some special logic which is the same as on the Zoom client. 1. AddLink's position can not cross multi lines. 2. A BulletedList will clear the formatting of a NumberedList, Quote, or LeftIndent after it. 3. Likewise, a NumberedList will clear the formatting of a BulletedList, Quote, or LeftIndent after it. 4. Only AddLink, NumberedList and BulletedList can apply to a message which already applied a Quote. 5. A Quote will clear the formatting of all styles after it except AddLink, NumberedList, BulletedList, or Italic. 6. An AddLink will clear the formatting of BackgroundColor, FontColor, or Underline after it. 7. BackgroundColor, FontColor and Underline can not apply to a message which already applied AddLink. 8. BulletedList, NumberedList, LeftIndent, Paragraph, and Quote will automatically expand to apply to the whole line. - type: string - auto: PREDEFINED - predefined: - - FontSize - - FontColor - - BackgroundColor - - LeftIndent - - Paragraph - - AddLink - - name: format_attr - description: > - This field is required if the value of the format_type field is listed below: - 1.FontSize value: s for small, m for medium, or l for large font size. - 2.FontColor and BackgroundColor value: only supports RGB value. For example: FFC0CB - 3.LeftIndent value: a positive pixel length. - 4.Paragraph value: h1 for Heading 1, h2 for Heading 2, or h3 for Heading 3. - 5.AddLink value: must be a valid URL, with an http or https prefix. For example: https://example.com - type: string - name: message description: |- The message to be sent. Maximum of 1024 characters. - You can provide a markdown message without any other arguments like format type,format attr,start and end position and rt start and end_position + You can provide a markdown format | Element | Markdown Syntax | |------------|-------------------| | Paragraph | # H1 , ## H2 ,### H3| @@ -931,7 +887,6 @@ script: | FontSize | [s|m|l](text)| | BackgroundColor| [#bg](text)| | Mention | @ if mention is not @all please provide argument at_contact= email| - required: true type: string - name: entry_ids diff --git a/Packs/Zoom/Integrations/Zoom/Zoom_test.py b/Packs/Zoom/Integrations/Zoom/Zoom_test.py index 63787fc946cf..5e34447d245f 100644 --- a/Packs/Zoom/Integrations/Zoom/Zoom_test.py +++ b/Packs/Zoom/Integrations/Zoom/Zoom_test.py @@ -1289,7 +1289,7 @@ def test_zoom_send_file_command(mocker): zoom_send_file_mock.assert_called_with(expected_upload_url, expected_file_info, expected_json_data) # Assert results - assert results.readable_output == 'Message with id file_id was successfully sent' + assert results.readable_output == 'Message with id file_id was successfully sent' def test_zoom_list_account_public_channels_command(mocker): @@ -1400,10 +1400,6 @@ def test_zoom_send_message_command_with_file(mocker): zoom_send_message_command(client, user_id=user_id, - at_contact='user2@example.com', - at_type='Mention a contact', - start_position=11, - end_position=16, message='Hello from @dima!', to_channel='channel1', entry_ids='entry_id' @@ -1429,21 +1425,6 @@ def test_zoom_send_message_command(mocker): expected_request_payload = { 'message': 'Hello from @dima!', 'to_channel': 'channel1', - 'at_items': [ - { - 'at_contact': 'user2@example.com', - 'at_type': 1, - 'start_position': 11, - 'end_position': 16 - } - ], - 'rich_text': [ - {'start_position': None, - 'end_position': None, - 'format_type': None, - 'format_attr': None - } - ], 'file_ids': [] } @@ -1459,10 +1440,6 @@ def test_zoom_send_message_command(mocker): result = zoom_send_message_command(client, user_id='user1', - at_contact='user2@example.com', - at_type='Mention a contact', - start_position=11, - end_position=16, message='Hello from @dima!', to_channel='channel1', @@ -1549,38 +1526,6 @@ def test_zoom_send_message_markdown_command_error_mentions(mocker): assert str(e.value) == "Too many mentions in text. you can provide only one mention in each message" -def test_zoom_send_message_markdown_command_error_too_many_arguments(mocker): - """ - Given - - client - When - - send message to channel with invalid markdown - Then - - Validate that an exception is raised - """ - client = Client(base_url='https://test.com', account_id="mockaccount", - client_id="mockclient", client_secret="mocksecret") - - from Zoom import zoom_send_message_command - - with pytest.raises(Exception) as e: - zoom_send_message_command(client, - user_id='user1', - at_contact='user2@example.com', - is_markdown=True, - message="@user This is an markdown", - to_channel='channel1', - start_position=0, - end_position=4, - at_type='Mention a contact', - - ) - - assert str(e.value) == """Too many arguments. If you choose is_markdown, - don't provide one of the following arguments: start_position, end_position, format_type, at_type, - rt_start_position, rt_end_position or format_attr""" - - def test_zoom_list_messages_command(mocker): """ Given - @@ -1592,11 +1537,9 @@ def test_zoom_list_messages_command(mocker): Validate the command results including outputs and readable output """ client = Client(base_url='https://test.com', account_id="mockaccount", client_id="mockclient", client_secret="mocksecret") - page_size = 50 channel_id = "channel_id" user_id = "user_id" limit = 100 - page_number = 2 to_contact = "contact@example.com" to_channel = "channel_id" date_arg = "2023-03-07T00:49:01Z" @@ -1628,12 +1571,10 @@ def test_zoom_list_messages_command(mocker): result = zoom_list_messages_command( client, - page_size=page_size, channel_id=channel_id, user_id=user_id, next_page_token='next_page_token', limit=limit, - page_number=page_number, to_contact=to_contact, to_channel=to_channel, date=date_arg, diff --git a/Packs/Zoom/ReleaseNotes/1_5_1.md b/Packs/Zoom/ReleaseNotes/1_5_1.md new file mode 100644 index 000000000000..08de5a6ff256 --- /dev/null +++ b/Packs/Zoom/ReleaseNotes/1_5_1.md @@ -0,0 +1,12 @@ + +#### Integrations + +##### Zoom + +- **Breaking changes**: The following arguments were removed from ***zoom-send-message*** command, please use markdown in order to create formatted message: + - ***start_position*** + - ***end_position*** + - ***rt_start_position*** + - ***rt_end_position*** + - ***format_type*** + - ***format_attr*** diff --git a/Packs/Zoom/pack_metadata.json b/Packs/Zoom/pack_metadata.json index 663ab21b4724..443783af3533 100644 --- a/Packs/Zoom/pack_metadata.json +++ b/Packs/Zoom/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Zoom", "description": "Use the Zoom integration manage your Zoom users and meetings", "support": "xsoar", - "currentVersion": "1.5.0", + "currentVersion": "1.5.1", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "",