def post_message(message, channel=None, username=None, api_url=None, hook=None):
 if (not api_url):
  api_url = _get_api_url()
 if (not hook):
  hook = _get_hook()
 if (not username):
  username = _get_username()
 if (not channel):
  channel = _get_channel()
 if (not message):
  log.error('message is a required option.')
 parameters = dict()
 if channel:
  parameters['channel'] = channel
 if username:
  parameters['username'] = username
 parameters['text'] = (('```' + message) + '```')
 log.debug('Parameters: {0}'.format(parameters))
 result = salt.utils.mattermost.query(api_url=api_url, hook=hook, data='payload={0}'.format(json.dumps(parameters)))
 if result:
  return True
 else:
  return result

def post_message ( message , channel = None , username = None , api_url = None , hook = None ) : if ( not api_url ) : api_url = _get_api_url ( ) if ( not hook ) : hook = _get_hook ( ) if ( not username ) : username = _get_username ( ) if ( not channel ) : channel = _get_channel ( ) if ( not message ) : log . error ( 'message is a required option.' ) parameters = dict ( ) if channel : parameters [ 'channel' ] = channel if username : parameters [ 'username' ] = username parameters [ 'text' ] = ( ( '```' + message ) + '```' ) log . debug ( 'Parameters: {0}' . format ( parameters ) ) result = salt . utils . mattermost . query ( api_url = api_url , hook = hook , data = 'payload={0}' . format ( json . dumps ( parameters ) ) ) if result : return True else : return result
send a message to a mattermost channel .