Programmatically update your Slack status
-
Create a legacy slack token here.
(You'll need this info later)
-
Create a new app in slack here.
- Go to oAuth & Permissions
- Add a scope for modifying user profiles:
users.profile.write
- Install the app to your workspace
- Create a new user in IAM
-
Grant the user admin access
-
Create an access key
-
Download the .csv
(you'll need this info in the next step)
-
-
If not already installed, run
npm i -g serverless
in terminal -
Then run:
serverless config credentials --provider aws --key <<KEY FROM CSV>> --secret <<SECRET FROM CSV>>
-
Afterward cd into the statusbot directory then run:
npm init; npm i;
-
Finally run:
serverless deploy
to deploy the lambda to AWS
You can now use the provided endpoint to make POST requests (Body JSON required- see below).
If This Than That is an extremely flexible way to trigger the lamba.
-
You can use any trigger for the 'This'. (I used the Location trigger)
-
Use Webhooks for the 'That'
-
Enter your endpoint url
-
Switch the mime type to POST
-
Input the following json in the body:
{ "token": <<LEGACY SLACK TOKEN>>", "profile": {"status_text":"In the office","status_emoji":":office:"} }