Package: afk-slack-agent
Signal you A.F.K. (Away From Keyboard) status on Slack, automatically.Table of ContentsInstallationWhat it does?PrerequisitesConfigurationOther settingsCustom actionsWhy?WarningThis software is for MacOS only!Installationpipinstallafk_slack_agentWhat it does?This software is distributed with an agent (afk_agent) and a client (afk, optional).The agent is designed to be run in the background and stay active until you terminate it.Features implemented by the agentwaits for lock screen and unlock screen eventsconnects to a Slack workspace, and change user status on lock (clean it on unlock)optionally: write a message on a channel on lock/unlockPrerequisitesyou have tocreate a Slack application, and install it into your workspace
- the application should have at least the followingscope:users.profile:write.optionally, you could also enablechat:writeandreactions:writeto run custom AFK commands from the client, you’ll need to enable the agent to control your Mac (from “Privacy and Security” system settings)ConfigurationThe first time the agent is run, a~/.afk.jsonfile is created.This is the default file created:{"version":1,"token":"","status_text":"I need a break","status_emoji":":coffee:","channel":null,"away_message":"I'm going to take a coffee break","back_message":"I'm back","delay_for_reaction_emoji":60,"back_emoji":"back","agent_emoji":"robot_face","actions":[{"action":"lunch","status_text":"Lunch break","status_emoji":":spaghetti:","away_message":"I'm going to take the lunch break","back_message":"I'm back and stuffed!","command":"lock"}]}The most important key istoken, which must contain the Slack User OAuth Token.Other settingsstatus_textStatus to be set when locking the screenstatus_emojiemoji to be set when locking the screenchanneluse this only if you want to write messages on a channel when going AFK and be back.Put the channel id there. You can find it by right-clicking on the channel and clicking “View channel details”.
It will be at the very bottom of the popup.away_messagemessage to send when going  AFKback_messagemessage to send when back to keyboarddelay_for_reaction_emojiin case you will be back before this amount of seconds, do not send a back message, but just react to your away message using a reaction emoji.
This will reduce noise in case of quick lock/unlock screenback_emojiemoji to be used for quick back reactionagent_emojiautomatically adds this emoji at the end of every message sent or slack status set.
This helps others to know there’s a bot that is acting for you.delay_after_screen_lockbefore starting interacting with Slack, wait this amount of seconds.This will delay reactions to your lock screen status a while, so no Slack commands will be run if you unlock the screen before this time.
As example: you are reading a document and the screen locks for inactivity, but you are not AFK.Custom actionsThe JSON configuration can contain anactionskey, with an array of custom actions.Custom actions can be sent to the agent using the client component:afklunchA custom action is a way to perform something more than the standard lock/unlock monitor.See theafkcommand line help for more.An action interact with Slack in the same way the agent does, and inherit the same configuration, but it can override some of them like:status_text,status_emoji,away_messageandback_message.
Every of these settings can benullto explicitly inherit from the global settings.back_messagecan also befalse: this disables the back message for the action even if the global setting has a value.Finally, a custom action can perform one of the following commands:lockLock the screen manuallysleepPut you computer to sleepWhy?To understand motivation about this tool, readwhy I needed to join my lock screen activities with Slack.