class_docstr: SlackOutput handles all alert dispatching for Slack
class_docstr_tok: ["SlackOutput","handles","all","alert","dispatching","for","Slack"]
docstr: Format the message to be sent to slack.
  
  Args:
      alert (Alert): The alert
      alert_publication (dict): Alert relevant to the triggered rule
  
  Returns:
      dict: message with attachments to send to Slack.
          The message will look like:
              StreamAlert Rule Triggered: rule_name
              Rule Description:
              This will be the docstring from the rule, sent as the rule_description
  
              Record (Part 1 of 2):
              ...
docstr_tok: ["Format","the","message","to","be","sent","to","slack",".","Args",":","alert","(","Alert",")",":","The","alert","alert_publication","(","dict",")",":","Alert","relevant","to","the","triggered","rule","Returns",":","dict",":","message","with","attachments","to","send","to","Slack",".","The","message","will","look","like",":","StreamAlert","Rule","Triggered",":","rule_name","Rule","Description",":","This","will","be","the","docstring","from","the","rule",",","sent","as","the","rule_description","Record","(","Part","1","of","2",")",":","..."]
code: def _format_message(cls, alert, alert_publication):
      """Format the message to be sent to slack.
  
      Args:
          alert (Alert): The alert
          alert_publication (dict): Alert relevant to the triggered rule
  
      Returns:
          dict: message with attachments to send to Slack.
              The message will look like:
                  StreamAlert Rule Triggered: rule_name
                  Rule Description:
                  This will be the docstring from the rule, sent as the rule_description
  
                  Record (Part 1 of 2):
                  ...
      """
      default_header_text = "*StreamAlert Rule Triggered: {}*".format(
          alert.rule_name
      )
      header_text = alert_publication.get(
          "@slack.text", default_header_text
      )
  
      if "@slack.attachments" in alert_publication:
          attachments = cls._standardize_custom_attachments(
              alert_publication.get("@slack.attachments")
          )
      else:
          # Default attachments
          attachments = cls._format_default_attachments(
              alert, alert_publication, header_text
          )
  
      full_message = {
          "text": header_text,
          "mrkdwn": True,
          "attachments": attachments,
      }
  
      # Return the json dict payload to be sent to slack
      return full_message
  
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 6 for calling the SlackOutput obj's underlying member method code with example usage: obj._format_message(cls, alert, alert_publication) and returns: full_message