def post_card(message,
              hook_url=None,
              title=None,
              theme_color=None):
    '''
    Send a message to an MS Teams channel.
    :param message:     The message to send to the MS Teams channel.
    :param hook_url:    The Teams webhook URL, if not specified in the configuration.
    :param title:       Optional title for the posted card
    :param theme_color:  Optional hex color highlight for the posted card
    :return:            Boolean if message was sent successfully.

    CLI Example:

    .. code-block:: bash

        salt '*' msteams.post_card message="Build is done"
    '''

    if not hook_url:
        hook_url = _get_hook_url()

    if not message:
        log.error('message is a required option.')

    payload = {
        "text": message,
        "title": title,
        "themeColor": theme_color
    }

    result = salt.utils.http.query(hook_url,
                                   method='POST',
                                   data=salt.utils.json.dumps(payload),
                                   status=True)

    if result['status'] <= 201:
        return True
    else:
        return {
            'res': False,
            'message': result.get('body', result['status'])
        }
def post_card ( message , hook_url = None , title = None , theme_color = None ) : if not hook_url : hook_url = _get_hook_url ( ) if not message : log . error ( 'message is a required option.' ) payload = { "text" : message , "title" : title , "themeColor" : theme_color } result = salt . utils . http . query ( hook_url , method = 'POST' , data = salt . utils . json . dumps ( payload ) , status = True ) if result [ 'status' ] <= 201 : return True else : return { 'res' : False , 'message' : result . get ( 'body' , result [ 'status' ] ) }
Send a message to an MS Teams channel.
    :param message:     The message to send to the MS Teams channel.
    :param hook_url:    The Teams webhook URL, if not specified in the configuration.
    :param title:       Optional title for the posted card
    :param theme_color:  Optional hex color highlight for the posted card
    :return:            Boolean if message was sent successfully.

    CLI Example:

    .. code-block:: bash

        salt '*' msteams.post_card message="Build is done"