Manipulate Presence
Learn to use Slack API calls to manipulate presence.
We'll cover the following
Overview
We’ll cover the following endpoints from Slack’s Users API in this lesson.
users.setPresence
: This endpoint manually sets user .presence This is a flag with the value of either “auto” or “away”. When it is set to “away” the user is shown as non-active. users.getPresence
: This endpoint gets user presence information.
Even though our application can set its presence with our current token, this isn’t that useful because no user can see the application’s “activity” status. It’ll be a lot more useful if a user could manipulate their presence, and to do that, we’ll need a
- Go to Slack’s API website and click on your application.
- Then go to the “OAuth & Permissions” tab on the left-hand sidebar.
- Now scroll down and click the “Add an OAuth Scope” for the “User Token Scopes”.
- Give the application the following scopes:
users:read
andusers:write
. - Click the “reinstall your app” on the yellow notification.
- Click the “Allow” button and copy the “User OAuth Token”.
- Paste it in the code widget below.
Get hands-on with 1200+ tech skills courses.