llama.files.slack.utils module

Utilities for interacting with slack. Used for slack upload filehandlers as well as various slack-based logging utilities.

llama.files.slack.utils.alert_maintainers(msg, desc=None)

Shortcut to send a message to the LLAMA maintainer of LLAMA functionality on the default LLAMA channel using alert_user. Import this from other parts of the code to have a Slack-based logging/alert tool. Optionally provide the name of the calling module (or some other description) as desc. Since this is meant to be used elsewhere in the code (including parts of the code that may run on non-production servers), it will fail if no SLACK_TOKENS['LLAMA'] is defined.

llama.files.slack.utils.alert_user(organization, userids, message, channel=None)

Send a simple text message to starting with a mention of userids channel (default: first channel registered for organization) in organization. Returns the response dict from slack.

llama.files.slack.utils.client(token=None)

Return a SlackClient instance for interacting with Slack’s API. Will default to the LLAMA slack organization (which will fail if you have not configured an auth token via environmental variables).

llama.files.slack.utils.get_users_for_org(organization)

Get list of users for an organization. Particularly useful because each user’s id value can be used to tag users, e.g. using alert_user; this information should be stored in USER_IDS. Returns the API dict straight from slackclient.

llama.files.slack.utils.send_message(organization, message, channel=None)

Send a simple text message to channel (default: first channel registered for organization) in organization. Returns the response dict from slack.