Skip to content

Instantly share code, notes, and snippets.

@taciturnaxolotl
Last active March 12, 2025 13:43
Show Gist options
  • Select an option

  • Save taciturnaxolotl/fb8ae4a0fade7d1210b9f8130f0e188a to your computer and use it in GitHub Desktop.

Select an option

Save taciturnaxolotl/fb8ae4a0fade7d1210b9f8130f0e188a to your computer and use it in GitHub Desktop.
slack profile set with user token
(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);
})();
@taciturnaxolotl
Copy link
Author

Follow the token grabbing process here: https://github.com/taciturnaxolotl/emojibot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment