slack¶
Convenience interface to send messages to the ACCRE slack
- accre.slack.simple_message(text, channel=None, username=None, icon=None)[source]¶
Send a simple text message to ACCRE slack.
- Parameters:
text (str) – message to send to slack
channel (str) – Channel or user to send to (use at-symbol for user) or default to random.
username (str) – Username to display in channel, defaults to combination of current posix user and host
icon (str) – Emoji icon to use for message, defaults to accre symbol. Colons are not required.
- accre.slack.status_message(pretext, items=None, channel=None, username=None, icon=None, color='good', footer=None)[source]¶
Send a formatted status message to ACCRE slack including a pretext header message, a set of named items with descrptions, and a status color. Generally suitable for messages from status checks or audits.
- Parameters:
pretext (str) – prefix for message to send to slack
items (dict) – mapping of keys which will appear as item headers in the message, and values for which the string representation will be the text of each message item.
channel (str) – Channel or user to send to (use at-symbol for user) or default to random.
username (str) – Username to display in channel, defaults to combination of current posix user and host
icon (str) – Emoji icon to use for message, defaults to accre symbol. Colons are not required.
color (str) – One of good (green), warning (yellow), danger (red) or a hex code, i.e. #439FE0
footer (str) – Optional message footer