class_docstr: SlackOutput handles all alert dispatching for Slack
class_docstr_tok: ["SlackOutput","handles","all","alert","dispatching","for","Slack"]
docstr: Yield messages that should be sent to slack.
  
  Args:
      alert_record (dict): Dictionary representation of the alert
          relevant to the triggered rule
  
  Yields:
      str: Properly split messages to be sent as attachments to slack
docstr_tok: ["Yield","messages","that","should","be","sent","to","slack",".","Args",":","alert_record","(","dict",")",":","Dictionary","representation","of","the","alert","relevant","to","the","triggered","rule","Yields",":","str",":","Properly","split","messages","to","be","sent","as","attachments","to","slack"]
code: def _split_attachment_text(cls, alert_record):
      """Yield messages that should be sent to slack.
  
      Args:
          alert_record (dict): Dictionary representation of the alert
              relevant to the triggered rule
  
      Yields:
          str: Properly split messages to be sent as attachments to slack
      """
      # Convert the alert we have to a nicely formatted string for slack
      alert_text = "\n".join(cls._json_to_slack_mrkdwn(alert_record, 0))
  
      # Slack requires escaping the characters: '&', '>' and '<' and html does just that
      alert_text = html.escape(alert_text)
  
      while alert_text:
          if len(alert_text) <= cls.MAX_MESSAGE_SIZE:
              yield alert_text
              break
  
          # Find the closest line break prior to this index
          index = alert_text[: cls.MAX_MESSAGE_SIZE + 1].rfind("\n")
  
          # If a new line was not found, split on the closest space instead
          if index == -1:
              index = alert_text[: cls.MAX_MESSAGE_SIZE + 1].rfind(" ")
  
          # If there is no good place to split the message, just use the max index
          if index == -1:
              index = cls.MAX_MESSAGE_SIZE
  
          # Append the message part up until this index, and move to the next chunk
          yield alert_text[:index]
          alert_text = alert_text[index + 1 :]
  
file_path: streamalert/streamalert/alert_processor/outputs/slack.py
imports: import html
  from collections import OrderedDict
  from streamalert.alert_processor.helpers import compose_alert, elide_string_middle
  from streamalert.alert_processor.outputs.output_base import OutputDispatcher, OutputProperty, OutputRequestFailure, StreamAlertOutput
  from streamalert.shared.logger import get_logger
label_desc: Use image node_id 2 for calling the SlackOutput obj's underlying member method code with example usage: obj._split_attachment_text(cls, alert_record) without return types