Last active
March 12, 2025 13:43
-
-
Save taciturnaxolotl/fb8ae4a0fade7d1210b9f8130f0e188a to your computer and use it in GitHub Desktop.
slack profile set with user token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (async () => { | |
| const formData = new FormData(); | |
| formData.append("token", process.env.SLACK_USER_TOKEN as string); | |
| formData.append( | |
| "profile", | |
| JSON.stringify({ | |
| status_emoji: ":thinking:", | |
| status_expiration: 1742011199, // omit for no expiration | |
| status_text: "test status", | |
| }), | |
| ); | |
| const res = await fetch("https://hackclub.slack.com/api/users.profile.set", { | |
| credentials: "include", | |
| method: "POST", | |
| body: formData, | |
| headers: { | |
| Cookie: `Cookie ${process.env.SLACK_COOKIE}`, | |
| }, | |
| }).then((res) => res.json()); | |
| if (!res.ok) { | |
| throw new Error( | |
| `Slack API Error: ${res.error || "Unknown error occurred"}`, | |
| ); | |
| } | |
| console.log("Status updated successfully:", res); | |
| })(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Follow the token grabbing process here: https://github.com/taciturnaxolotl/emojibot