diff --git a/nautobot_chatops/__init__.py b/nautobot_chatops/__init__.py index cce4c62d..782baee0 100644 --- a/nautobot_chatops/__init__.py +++ b/nautobot_chatops/__init__.py @@ -32,6 +32,7 @@ class NautobotChatOpsConfig(PluginConfig): # Slack-specific settings "slack_api_token": None, # for example, "xoxb-123456" "slack_signing_secret": None, + "slack_ephemeral_message_size_limit": 3000, # Any prefix that's prepended to all slash-commands for this bot and should be stripped away # in order to identify the actual command name to be invoked, eg "/nautobot-" "slack_slash_command_prefix": "/", diff --git a/nautobot_chatops/dispatchers/slack.py b/nautobot_chatops/dispatchers/slack.py index e011c25c..77147732 100644 --- a/nautobot_chatops/dispatchers/slack.py +++ b/nautobot_chatops/dispatchers/slack.py @@ -23,7 +23,7 @@ BACKEND_ACTION_BLOCKS = backend_action_sum.labels("slack", "send_blocks") BACKEND_ACTION_SNIPPET = backend_action_sum.labels("slack", "send_snippet") -SLACK_MAX_MESSAGE_LENGTH = 40000 +SLACK_PRIVATE_MESSAGE_LIMIT = settings.PLUGINS_CONFIG["nautobot_chatops"].get("slack_ephemeral_message_size_limit") class SlackDispatcher(Dispatcher): @@ -229,7 +229,7 @@ def send_snippet(self, text, title=None, ephemeral=None): try: # Check for the length of the file if the setup is meant to be a private message if ephemeral: - message_list = self.split_message(text, SLACK_MAX_MESSAGE_LENGTH) + message_list = self.split_message(text, SLACK_PRIVATE_MESSAGE_LIMIT) for msg in message_list: # Send the blocks as a list, this needs to be the case for Slack to send appropriately. self.send_blocks([self.markdown_block(f"```\n{msg}\n```")], ephemeral=ephemeral) diff --git a/pyproject.toml b/pyproject.toml index f3e9ec12..95c611d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nautobot-chatops" -version = "1.7.0" +version = "1.7.1" description = "A plugin providing chatbot capabilities for Nautobot" authors = ["Network to Code, LLC "] readme = "README.md"