Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contrib/slackv3 readchannel #29247

Merged
merged 26 commits into from
Aug 30, 2023

Conversation

content-bot
Copy link
Collaborator

Original External PR

external pull request

Contributor

@PaloSawyer

Contributing to Cortex XSOAR Content

Make sure to register your contribution by filling the contribution registration form

The Pull Request will be reviewed only after the contribution registration form is filled.

Status

  • In Progress
  • Ready
  • In Hold - (Reason for hold)

Description

This commit introduces three new integration commands to the SlackV3 integration. This will allow XSOAR developers to list channels, get conversations, and get threads related to conversations

Screenshots

Uploading ListChannels.png…
Uploading ConversationHistory.png…
Uploading ConversationReplies.png…

Minimum version of Cortex XSOAR

  • 6.5.0

Does it break backward compatibility?

  • No

Must have

  • Tests
  • Documentation

* Test SDK Commands

* Testing branch development

* forking with josh

* testing branch fork

* Add funtion to return the raw results of client.conversations_list for output validation and testing

* Add new command and arguments to yaml file. Make changes to list_conversations function for testing

* Added converstation_history command & function

* Add arguments to yml for the two new fucntions (list and history). Adjust code for conversation_history() to use the GET method instead of POST

* Added CommandResults to return output of the conversation_history command

* Fixed conversation_history CommandResults added commas to json objects

* For slack-list-channels, add the arguments that are outlined in the SDK documentation (channel_types, exclude_archived, limit, and cursor). This now supports returning different kinds of channels, archived channels, and pagination with limit and cursor

* Added raw-response & limit to conversation_history function

* Add name_filter argument to return a specific channels details. Also include basic context data parsing

* removed the 'int' type from limit

* Commented out CommandResults to continue building out response structure for context

* Add context outputs to yml configuration. Add CommandResults object for context, human readable, and raw output

* Update outputs with demisto.results(). Proper output of humanreadable, raw response, and context for the list_channels command

* conversation_history function working. Began working on mapping user IDs to usernames

* Added User ID to Username Mapping for converstation_history

* Began working on SlackV3_test.py. Need to added structured test data for conversation_history

* Modified conversation_history context output to align with code standards

* Added limit argument to conversation history command

* Added conversation ID for search, and identification of threads/replies in conversation_history command - RAF

* Added function conversation_replies to read threads from parent messages - RAF

* Updated get-replies to include Bot Responses

* Add user fetch for channel creator

* Adjust parsing and output for list_channels() for more consistency and less redundancy

* Updated conversation_replies & conversation_history with dict to list statement

* Added all Emoji commands

* Added more error handling to conversation_history and conversation_replies

* added description to the reaction commands

* Remove Emoji Functions and Commands

* Refactored conversation_history & conversation_replies to remove repeated variables and json

* Removed whitespace from the import statements and at the end of the integration

* adding RL

* adding unit tests

* accepted incoming changes

* added new test files

* Accepted Changes to both SlackV3 yaml and pack_metadata.json

* Added amshamah419 suggestions for conversation_history, list_channels, and conversation_replies

* Added correct error messaging to recommended return_error functions

* conflicts

* Fixed Flake8 E999 SyntaxError

* Resolved Flake8, Vulture, and Mypy Errors on SlackV3.py

* added .secrets-ignore file to pack and added a false positive secret

---------

Co-authored-by: RAF <[email protected]>
Co-authored-by: maimorag <[email protected]>
Co-authored-by: edibleShell <[email protected]>
Co-authored-by: bziser <[email protected]>
Co-authored-by: Mai Morag <[email protected]>
@content-bot content-bot added Contribution Thank you! Contributions are always welcome! docs-approved ready-for-instance-test In contribution PRs, this label will cause a trigger of a build with a modified pack from the PR. Contribution Form Filled Whether contribution form filled or not. Community pending-contributor The PR is pending the response of its creator Xsoar Support Level Indicates that the contribution is for XSOAR supported pack labels Aug 27, 2023
@content-bot content-bot requested a review from maimorag August 27, 2023 11:14
if isinstance(channels, dict):
channels = [channels]
context = [] # type: List
if isinstance(channels, list):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why wound't it be? 🤔
I mean, we just wrapped a dictionary with [] three lines up

readable_output = tableToMarkdown(f'Channel details from Channel ID - {channel_id}', context)
else:
error = raw_response.get('error')
return_error(f'An error occurred while listing conversation replies: {error}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why sometimes return_error and sometimes DemistoException? We should only raise

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

@maimorag maimorag requested a review from dorschw August 30, 2023 13:39
@maimorag maimorag merged commit ed4dbdc into master Aug 30, 2023
@maimorag maimorag deleted the contrib/PaloSawyer_contrib/Slackv3-readchannel branch August 30, 2023 13:48
xsoar-bot pushed a commit to xsoar-contrib/content that referenced this pull request Oct 5, 2023
* Contrib/slackv3 readchannel (demisto#27985)

* Test SDK Commands

* Testing branch development

* forking with josh

* testing branch fork

* Add funtion to return the raw results of client.conversations_list for output validation and testing

* Add new command and arguments to yaml file. Make changes to list_conversations function for testing

* Added converstation_history command & function

* Add arguments to yml for the two new fucntions (list and history). Adjust code for conversation_history() to use the GET method instead of POST

* Added CommandResults to return output of the conversation_history command

* Fixed conversation_history CommandResults added commas to json objects

* For slack-list-channels, add the arguments that are outlined in the SDK documentation (channel_types, exclude_archived, limit, and cursor). This now supports returning different kinds of channels, archived channels, and pagination with limit and cursor

* Added raw-response & limit to conversation_history function

* Add name_filter argument to return a specific channels details. Also include basic context data parsing

* removed the 'int' type from limit

* Commented out CommandResults to continue building out response structure for context

* Add context outputs to yml configuration. Add CommandResults object for context, human readable, and raw output

* Update outputs with demisto.results(). Proper output of humanreadable, raw response, and context for the list_channels command

* conversation_history function working. Began working on mapping user IDs to usernames

* Added User ID to Username Mapping for converstation_history

* Began working on SlackV3_test.py. Need to added structured test data for conversation_history

* Modified conversation_history context output to align with code standards

* Added limit argument to conversation history command

* Added conversation ID for search, and identification of threads/replies in conversation_history command - RAF

* Added function conversation_replies to read threads from parent messages - RAF

* Updated get-replies to include Bot Responses

* Add user fetch for channel creator

* Adjust parsing and output for list_channels() for more consistency and less redundancy

* Updated conversation_replies & conversation_history with dict to list statement

* Added all Emoji commands

* Added more error handling to conversation_history and conversation_replies

* added description to the reaction commands

* Remove Emoji Functions and Commands

* Refactored conversation_history & conversation_replies to remove repeated variables and json

* Removed whitespace from the import statements and at the end of the integration

* adding RL

* adding unit tests

* accepted incoming changes

* added new test files

* Accepted Changes to both SlackV3 yaml and pack_metadata.json

* Added amshamah419 suggestions for conversation_history, list_channels, and conversation_replies

* Added correct error messaging to recommended return_error functions

* conflicts

* Fixed Flake8 E999 SyntaxError

* Resolved Flake8, Vulture, and Mypy Errors on SlackV3.py

* added .secrets-ignore file to pack and added a false positive secret

---------

Co-authored-by: RAF <[email protected]>
Co-authored-by: maimorag <[email protected]>
Co-authored-by: edibleShell <[email protected]>
Co-authored-by: bziser <[email protected]>
Co-authored-by: Mai Morag <[email protected]>

* adding false secret to secrets ignore

* update release note

* adding the new commands to read me

* ruff error

* fixing unit test

* fixing unit test

* fixing unit tests

* docker image upgrade

* ifx unit tests test_list_channels

* fixing unit tests

* fix mypy

* remove unnecessary "get"

* updating yml

* adding display to yml

* updating unit test

* after running format

* Update Packs/Slack/Integrations/SlackV3/SlackV3.py

Co-authored-by: dorschw <[email protected]>

* Update Packs/Slack/Integrations/SlackV3/SlackV3.py

Co-authored-by: dorschw <[email protected]>

* Update Packs/Slack/Integrations/SlackV3/SlackV3.py

Co-authored-by: dorschw <[email protected]>

* Update Packs/Slack/Integrations/SlackV3/SlackV3.py

Co-authored-by: dorschw <[email protected]>

* Update Packs/Slack/ReleaseNotes/3_1_47.md

Co-authored-by: dorschw <[email protected]>

* cr notes

* bump to 3.2.0

---------

Co-authored-by: Josh Sawyer <[email protected]>
Co-authored-by: RAF <[email protected]>
Co-authored-by: maimorag <[email protected]>
Co-authored-by: edibleShell <[email protected]>
Co-authored-by: bziser <[email protected]>
Co-authored-by: Mai Morag <[email protected]>
Co-authored-by: dorschw <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution Form Filled Whether contribution form filled or not. Contribution Thank you! Contributions are always welcome! docs-approved pending-contributor The PR is pending the response of its creator ready-for-instance-test In contribution PRs, this label will cause a trigger of a build with a modified pack from the PR. Xsoar Support Level Indicates that the contribution is for XSOAR supported pack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants