Slack Publish API

Want to publish alerts to Slack?

The source code reference guide is below and here is the intro to publishing alerts to Slack as a Jupyter Notebook.

Send Celery Task Details to Slack Utilities

Helper for extracting details from Celery task and sending it to a slack webhook.

Supported environment variables:

# slack webhook
export SLACK_WEBHOOK=https://hooks.slack.com/services/
analysis_engine.send_to_slack.post_df(df, columns=None, block=True, jupyter=True, full_width=True, tablefmt='github')[source]

Post a pandas.DataFrame to Slack

Parameters:
  • dfpandas.DataFrame object
  • columns – ordered list of columns to for the table header row (None by default)
  • block – bool for post as a Slack-formatted block `like this` (True by default)
  • jupyter – bool for jupyter attachment handling (True by default)
  • full_width – bool to ensure the width is preserved the Slack message (True by default)
  • tablefmt – string for table format (github by default). Additional format values can be found on: https://bitbucket.org/astanin/python-tabulate
analysis_engine.send_to_slack.post_success(msg, jupyter=False, block=False, full_width=False)[source]

Post a SUCCESS message to slack

Parameters:msg – A string, list, or dict to send to slack
analysis_engine.send_to_slack.post_failure(msg, jupyter=False, block=False, full_width=False)[source]

Post a FAILURE message to slack

Parameters:msg – A string, list, or dict to send to slack
analysis_engine.send_to_slack.post_message(msg, jupyter=False, block=False, full_width=False)[source]

Post any message to slack

Parameters:msg – A string, list, or dict to send to slack
analysis_engine.send_to_slack.parse_msg(msg, block=False)[source]

Create an array of fields for slack from the msg type

Parameters:msg – A string, list, or dict to massage for sending to slack
analysis_engine.send_to_slack.post(attachments, jupyter=False)[source]

Send created attachments to slack

Parameters:attachments – Values to post to slack