We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b040100 commit 511cf7bCopy full SHA for 511cf7b
nodejs-functions/.serverless/src/handlers/automatic-clock-outs/slack_client.js
@@ -0,0 +1,18 @@
1
+const { WebClient, LogLevel } = require("@slack/web-api");
2
+const { slackApiToken } = require("./config");
3
+
4
+const client = new WebClient(slackApiToken,{logLevel: LogLevel.DEBUG,});
5
6
+const findUsersInSlack = async () => {
7
+ const response = await client.users.list();
8
+ let usersIdAndEmails = [];
9
+ if (response.ok) {
10
+ slackUsers = response.members;
11
+ usersIdAndEmails = slackUsers
12
+ .filter((user) => user.profile.hasOwnProperty("email") && !user.deleted)
13
+ .map((user) => ({ id: user.id, email: user.profile.email }));
14
+ }
15
+ return usersIdAndEmails;
16
+};
17
18
+module.exports = { findUsersInSlack };
0 commit comments