0

Find User by Email

by
Published Jun 6, 2022

**IMPORTANT** this script requires slack oauth token with `users:read` and `users:read.email` scopes (as per https://api.slack.com/scopes/users:read.email)

Script slack Verified

The script

Submitted by hugo989 Bun
Verified 6 days ago
1
import { WebClient } from "@slack/web-api";
2

3
type Slack = {
4
  token: string;
5
};
6
export async function main(email: string, slack: Slack) {
7
  const web = new WebClient(slack.token);
8

9
  let response = await web.users.lookupByEmail({
10
    email: email,
11
  });
12

13
  return { response: response };
14
}
15

Other submissions
  • Submitted by rossmccrann Deno
    Created 384 days ago
    1
    import { WebClient } from "https://deno.land/x/[email protected]/mod.ts";
    2
    
    
    3
    type Slack = {
    4
      token: string;
    5
    };
    6
    export async function main(email: string, slack: Slack) {
    7
      const web = new WebClient(slack.token);
    8
    
    
    9
      let response = await web.users.lookupByEmail({
    10
        email: email,
    11
      });
    12
    
    
    13
      return { response: response };
    14
    }
    15