backend.utils.mattermost

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

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

Parameter:
  • 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.

Rückgabe:

True on success.

Rückgabetyp:

bool

Verursacht:
  • 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.