salt.runners.mattermost

Note for 2017.7 releases!

Due to the salt.runners.config module not being available in this release series, importing the salt.runners.config module from the master branch is required to make this module work.

Ref: Mattermost runner failing to retrieve config values due to unavailable config runner #43479

Module for sending messages to Mattermost

New in version 2017.7.0.

configuration:

This module can be used by either passing an api_url and hook directly or by specifying both in a configuration profile in the salt master/minion config. For example:

mattermost:
  hook: peWcBiMOS9HrZG15peWcBiMOS9HrZG15
  api_url: https://example.com
salt.runners.mattermost.post_event(event, channel=None, username=None, api_url=None, hook=None)

Send an event to a Mattermost channel. :param channel: The channel name, either will work. :param username: The username of the poster. :param event: The event to send to the Mattermost channel. :param api_url: The Mattermost api url, if not specified in the configuration. :param hook: The Mattermost hook, if not specified in the configuration. :return: Boolean if message was sent successfully.

salt.runners.mattermost.post_message(message, channel=None, username=None, api_url=None, hook=None)

Send a message to a Mattermost channel. :param channel: The channel name, either will work. :param username: The username of the poster. :param message: The message to send to the Mattermost channel. :param api_url: The Mattermost api url, if not specified in the configuration. :param hook: The Mattermost hook, if not specified in the configuration. :return: Boolean if message was sent successfully.

CLI Example:

salt-run mattermost.post_message message='Build is done'