0

Set User Status

by
Published today

Set the connected user's status text, emoji and expiry. Requires a user token with users.profile:write.

Script slack Verified

The script

Submitted by hugo989 Bun
Verified 1 hour ago
1
import { WebClient } from "@slack/web-api"
2

3
/**
4
 * Set User Status
5
 * Set the connected user's status. `status_emoji` is an emoji with colons, e.g. ":palm_tree:". `status_expiration` is a Unix timestamp in seconds; 0 or empty keeps the status until changed. Empty text and emoji clear the status. Requires a user token with users.profile:write.
6
 */
7
export async function main(
8
  auth: RT.Slack,
9
  status_text?: string,
10
  status_emoji?: string,
11
  status_expiration?: number
12
) {
13
  const client = new WebClient(auth.token)
14
  return await client.users.profile.set({
15
    profile: {
16
      status_text: status_text ?? "",
17
      status_emoji: status_emoji ?? "",
18
      status_expiration: status_expiration ?? 0,
19
    },
20
  })
21
}
22