Notebooks 2.0 is here.
Read the preview announcement
Platform
Resources
Pricing
Sign in
Get started
Stefan Wasserbauer
Workspace
Fork
Published
By
Stefan Wasserbauer
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.
Try it for free
Learn more
Fork
View
Export
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Slack
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
slack
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
getUserList
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
userList
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
getUserDetail
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML