Skip to content

Instantly share code, notes, and snippets.

@skippednote
Created June 13, 2021 09:25
Show Gist options
  • Save skippednote/a1d33a4b546aad0dd55f2b6f17f58d7d to your computer and use it in GitHub Desktop.
Save skippednote/a1d33a4b546aad0dd55f2b6f17f58d7d to your computer and use it in GitHub Desktop.
import { WebClient } from "@slack/web-api";
const token = process.env.SLACK_TOKEN;
const client = new WebClient(token);
async function main() {
try {
const { users } = await client.usergroups.users.list({
usergroup: "S0DG3F3FD",
});
const usersInfo = await Promise.all(
users!.map((user) => client.users.profile.get({ user }))
);
const a = usersInfo
.map(({ profile }) => ({
name: profile!.real_name,
image: profile!.image_192,
}))
.map(({ name, image }) => `<li>${name}</li>`)
.join("");
console.log(a);
} catch (e) {
console.error(e);
}
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment