qcodes_loop.extensions.slack¶
Slack bot is used to send information about qcodes via Slack IMs. Some default commands are provided, and custom commands/tasks can be attached (see below).
To setup the Slack bot, a bot first has to be created via Slack
by clicking ‘Create New App’ on https://api.slack.com/apps.
Once created, the bot will have a name and unique token.
These and other settings have to be saved in a config dict (see init( or
Parameters) in Slack
).
The App containing your bot needs to have the following bot token scopes to perform all methods successfully: - channels:history - channels:read - chat:write - files:write - users:read These can be set after clicking OAuth & Permissions in the left menubar after selecting your bot at https://api.slack.com/apps (or during creation).
Communication with the Slack bot is performed via instant messaging. When an IM is sent to the Slack bot, it will be processed during the next update() call (provided the username is registered in the config). Standard commands provided to the Slack bot are:
plot: Upload latest qcodes plot.
msmt/measurement: Print information about latest measurement.
notify finished: Send message once measurement is finished.
Custom commands can be added as (cmd, func) key-value pairs to self.commands. When cmd is sent to the bot, func is evaluated.
Custom tasks can be added as well. These are functions that are performed every time an update is called. The function must return a boolean that indicates if the task should be removed from the list of tasks. A custom task can be added as a (cmd, func) key-value pair to self.task_commands. They can then be called through Slack IM via:
notify/task {cmd} *args:
register task with name cmd that is
performed every time update() is called.