class_docstr: TeamsOutput handles all alert dispatching for Microsoft Teams
class_docstr_tok: ["TeamsOutput","handles","all","alert","dispatching","for","Microsoft","Teams"]
docstr: Sends the Teams Card to Teams
  
  Publishing:
      By default the teams output sends a teams card comprising some default intro text
      and a section containing:
      * title with rule name
      * alert description
      * alert record (as a section of key/value pairs)
  
      To override this behavior use the following fields:
  
      - @teams.title (str):
          Replaces the title of the teams connector card.
  
      - @teams.description (str):
          Replaces the text of the team connector card
  
      - @teams.card_color (str):
          Replaces the default color of the connector card (red)
          Note: colors are represented by hex string
  
      - @teams.with_record (bool):
          Set to False, to remove the alert record section. Useful if you want to have a
          more targeted approach for the alert
  
      - @teams.additional_card_sections (list[pymsteams.cardsection]):
          Pass in additional sections you want to send on the message.
  
          @see cls._add_additional_sections() for more info
  
      - @teams.buttons (list[(text, url)])
          Pass a list of tuples containing the button text and url
  
          These will be placed at the bottom of a teams card
  
  Args:
      alert (Alert): Alert instance which triggered a rule
      descriptor (str): Output descriptor
  
  Returns:
      bool: True if alert was sent successfully, False otherwise
docstr_tok: ["Sends","the","Teams","Card","to","Teams","Publishing",":","By","default","the","teams","output","sends","a","teams","card","comprising","some","default","intro","text","and","a","section","containing",":","*","title","with","rule","name","*","alert","description","*","alert","record","(","as","a","section","of","key\/value","pairs",")","To","override","this","behavior","use","the","following","fields",":","-","@","teams.title","(","str",")",":","Replaces","the","title","of","the","teams","connector","card",".","-","@","teams.description","(","str",")",":","Replaces","the","text","of","the","team","connector","card","-","@","teams.card_color","(","str",")",":","Replaces","the","default","color","of","the","connector","card","(","red",")","Note",":","colors","are","represented","by","hex","string","-","@","teams.with_record","(","bool",")",":","Set","to","False",",","to","remove","the","alert","record","section",".","Useful","if","you","want","to","have","a","more","targeted","approach","for","the","alert","-","@","teams.additional_card_sections","(","list","[","pymsteams.cardsection","]",")",":","Pass","in","additional","sections","you","want","to","send","on","the","message",".","@","see","cls._add_additional_sections","(",")","for","more","info","-","@","teams.buttons","(","list","[","(","text",",","url",")","]",")","Pass","a","list","of","tuples","containing","the","button","text","and","url","These","will","be","placed","at","the","bottom","of","a","teams","card","Args",":","alert","(","Alert",")",":","Alert","instance","which","triggered","a","rule","descriptor","(","str",")",":","Output","descriptor","Returns",":","bool",":","True","if","alert","was","sent","successfully",",","False","otherwise"]
code: def _dispatch(self, alert, descriptor):
      """Sends the Teams Card to Teams
  
      Publishing:
          By default the teams output sends a teams card comprising some default intro text
          and a section containing:
          * title with rule name
          * alert description
          * alert record (as a section of key/value pairs)
  
          To override this behavior use the following fields:
  
          - @teams.title (str):
              Replaces the title of the teams connector card.
  
          - @teams.description (str):
              Replaces the text of the team connector card
  
          - @teams.card_color (str):
              Replaces the default color of the connector card (red)
              Note: colors are represented by hex string
  
          - @teams.with_record (bool):
              Set to False, to remove the alert record section. Useful if you want to have a
              more targeted approach for the alert
  
          - @teams.additional_card_sections (list[pymsteams.cardsection]):
              Pass in additional sections you want to send on the message.
  
              @see cls._add_additional_sections() for more info
  
          - @teams.buttons (list[(text, url)])
              Pass a list of tuples containing the button text and url
  
              These will be placed at the bottom of a teams card
  
      Args:
          alert (Alert): Alert instance which triggered a rule
          descriptor (str): Output descriptor
  
      Returns:
          bool: True if alert was sent successfully, False otherwise
      """
      creds = self._load_creds(descriptor)
      if not creds:
          LOGGER.error(
              "No credentials found for descriptor: %s", descriptor
          )
          return False
  
      # Create the publication
      publication = compose_alert(alert, self, descriptor)
  
      # Format the message
      teams_card = self._format_message(
          alert, publication, creds["url"]
      )
  
      try:
          teams_card.send()
      except TeamsWebhookException as err:
          LOGGER.error("Error Sending Alert to Teams: %s", err)
          return False
  
      return True
  
file_path: streamalert/streamalert/alert_processor/outputs/teams.py
imports: from collections import OrderedDict
  import pymsteams
  from pymsteams import TeamsWebhookException
  from streamalert.alert_processor.helpers import compose_alert
  from streamalert.alert_processor.outputs.output_base import OutputDispatcher, OutputProperty, StreamAlertOutput
  from streamalert.shared.logger import get_logger
label_desc: Use image node_id 7 for calling the TeamsOutput obj's underlying member method code with example usage: obj._dispatch(alert, descriptor) and returns: True, False, False