MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / processTeamJoin

Function processTeamJoin

apps/web/services/slack/webhooks/processTeamJoin.ts:6–24  ·  view source on GitHub ↗
(body: SlackEvent)

Source from the content-addressed store, hash-verified

4import { buildUserFromInfo } from '../serializers/buildUserFromInfo';
5
6export async function processTeamJoin(body: SlackEvent) {
7 const event = body.event as SlackTeamJoinEvent;
8 const team_id = event.user.team_id;
9 // find account by slack team id
10 const account = await findAccountBySlackTeamId(team_id);
11 if (!account?.id) {
12 return {
13 status: 404,
14 error: 'Account not found',
15 metadata: { team_id },
16 };
17 }
18 const param = buildUserFromInfo(event.user, account.id);
19 await createUser(param);
20 return {
21 status: 201,
22 message: 'User created',
23 };
24}

Callers 1

handleWebhookFunction · 0.90

Calls 3

findAccountBySlackTeamIdFunction · 0.90
buildUserFromInfoFunction · 0.90
createUserFunction · 0.90

Tested by

no test coverage detected