Notebooks 2.0 is here.

Published
Edited
Jan 24, 2021
Insert cell
md`# Fetch Slack users
Simple snippets to fetch the list of users in a workspace and get the name and icon of a user.`
Insert cell
Slack = require('https://bundle.run/slack-node@0.1.8')
Insert cell
md`Use the secret store when forking this notebook as a private one.`
Insert cell
slack = new Slack(Secret("SlackToken"));
Insert cell
function getUserList(callback) {
slack.api("users.list", callback);
}
Insert cell
{
getUserList((error, response) => {
mutable userList = response.members;
});
}
Insert cell
mutable userList = 0;
Insert cell
function getUserDetail(name, userlist) {
for(let user of userlist) {
if(user.name === name) {
return { name: user.real_name, img: user.profile.image_24 };
}
}
}
Insert cell
getUserDetail("mike.green", await userList);
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more