0

Set Channel Topic

by
Published today

Set a channel's topic. Requires channels:write.topic (or channels:manage for a bot token, channels:write for a user token).

Script slack Verified

The script

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

3
/**
4
 * Set Channel Topic
5
 * Set the topic of a channel the token's user or app is in. Plain text, up to 250 characters; an empty string clears it. Requires channels:write.topic on the connection (or channels:manage for a bot token, channels:write for a user token); private channels need groups:write.topic.
6
 */
7
export async function main(auth: RT.Slack, channel: string, topic: string) {
8
  const client = new WebClient(auth.token)
9
  return await client.conversations.setTopic({ channel, topic })
10
}
11