backend.utils.mattermost

backend.utils.mattermost.send_mm_message(text, webhook='https://your-mattermost-instance.com/hooks/xxx', channel=None)[source]

Send a message to a Mattermost channel via an Incoming Webhook.

Parameters:
  • text (str) – The message text to send (Markdown supported).

  • webhook (str) – Webhook URL. Defaults to the MATTERMOST_WEBHOOK_URL environment variable.

  • channel (str | None) – Optional channel override. If None the webhook’s default channel is used.

Returns:

True on success.

Return type:

bool

Raises:
  • ValueError – If webhook is empty/None or text is None.

  • TypeError – If text or channel are not strings.

  • requests.exceptions.HTTPError – If the Mattermost server returns a non-2xx status code.