MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / handleWhoamiCommand

Function handleWhoamiCommand

server/src/slack/commands.ts:252–371  ·  view source on GitHub ↗

* /aao whoami - Show linked account info

(command: SlackSlashCommand)

Source from the content-addressed store, hash-verified

250 * /aao whoami - Show linked account info
251 */
252async function handleWhoamiCommand(command: SlackSlashCommand): Promise<CommandResponse> {
253 try {
254 const mapping = await slackDb.getBySlackUserId(command.user_id);
255
256 if (!mapping) {
257 return {
258 response_type: 'ephemeral',
259 text: 'Your Slack account is not in our system yet',
260 blocks: [
261 {
262 type: 'section',
263 text: {
264 type: 'mrkdwn',
265 text: ':question: *Account Not Found*\n\nYour Slack account is not yet synced with AAO. An admin may need to sync Slack users first.',
266 },
267 },
268 ],
269 };
270 }
271
272 if (!mapping.workos_user_id) {
273 return {
274 response_type: 'ephemeral',
275 text: 'Your Slack account is not linked to an AAO account',
276 blocks: [
277 {
278 type: 'section',
279 text: {
280 type: 'mrkdwn',
281 text: ':link: *Account Not Linked*',
282 },
283 },
284 {
285 type: 'section',
286 fields: [
287 {
288 type: 'mrkdwn',
289 text: `*Slack User:*\n${mapping.slack_real_name || mapping.slack_display_name || command.user_name}`,
290 },
291 {
292 type: 'mrkdwn',
293 text: `*Slack Email:*\n${mapping.slack_email || 'Not available'}`,
294 },
295 ],
296 },
297 {
298 type: 'section',
299 text: {
300 type: 'mrkdwn',
301 text: 'Use `/aao link` to link your Slack account to your AAO account.',
302 },
303 },
304 ],
305 };
306 }
307
308 // Get all organizations for this user
309 const userOrgs = await getOrganizationsForUser(mapping.workos_user_id);

Callers 1

handleSlashCommandFunction · 0.85

Calls 2

getOrganizationsForUserFunction · 0.85
getBySlackUserIdMethod · 0.80

Tested by

no test coverage detected