#!/SNS/users/y8z/miniconda/envs/slack/bin/python # -*- coding: utf-8 -*- from slack_sdk import WebClient import json calib_file = "/SNS/PG3/shared/CALIBRATION/cal_config.json" with open(calib_file, "r") as f: calib_config = json.load(f) dia_file = calib_config["Diamond"] out_dir = calib_config["OutputDir"] slack_msg = f"Calibration file generated for diamond run `{dia_file}`\n" slack_msg += f"Check the calibration H5 file " slack_msg += f"at, `{out_dir}`.\n" slack_msg += "If not seeing the calibration file, " slack_msg += "log in Analysis and run `pg3_cal` to " slack_msg += "prepare the calibration file." sltk = "xoxb-......" # <= Slack token starting with 'xoxb' goes here client = WebClient(token=sltk) client.chat_postMessage(channel="powgen-monitor", text=slack_msg)