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

Function handleLinkCommand

server/src/slack/commands.ts:379–453  ·  view source on GitHub ↗

* /aao link - Instructions to link accounts * * If the user doesn't have an AAO account, sends them to signup with their * slack_user_id so they can be auto-linked after registration.

(command: SlackSlashCommand)

Source from the content-addressed store, hash-verified

377 * slack_user_id so they can be auto-linked after registration.
378 */
379async function handleLinkCommand(command: SlackSlashCommand): Promise<CommandResponse> {
380 try {
381 const mapping = await slackDb.getBySlackUserId(command.user_id);
382
383 if (mapping?.workos_user_id) {
384 return {
385 response_type: 'ephemeral',
386 text: 'Your account is already linked',
387 blocks: [
388 {
389 type: 'section',
390 text: {
391 type: 'mrkdwn',
392 text: ':white_check_mark: *Your Slack account is already linked to AAO*\n\nUse `/aao status` to check your subscription status.',
393 },
394 },
395 ],
396 };
397 }
398
399 // Build login URL with slack_user_id for auto-linking after authentication
400 const loginUrl = `https://agenticadvertising.org/auth/login?slack_user_id=${encodeURIComponent(command.user_id)}`;
401
402 return {
403 response_type: 'ephemeral',
404 text: 'Link your Slack account to AAO',
405 blocks: [
406 {
407 type: 'section',
408 text: {
409 type: 'mrkdwn',
410 text: ':link: *Link Your Slack Account to AAO*',
411 },
412 },
413 {
414 type: 'section',
415 text: {
416 type: 'mrkdwn',
417 text: 'Click the button below to sign in to AAO. Your Slack account will be automatically linked.',
418 },
419 },
420 {
421 type: 'actions',
422 elements: [
423 {
424 type: 'button',
425 text: {
426 type: 'plain_text',
427 text: 'Sign In to AAO',
428 emoji: true,
429 },
430 url: loginUrl,
431 style: 'primary',
432 },
433 ],
434 },
435 {
436 type: 'context',

Callers 1

handleSlashCommandFunction · 0.85

Calls 1

getBySlackUserIdMethod · 0.80

Tested by

no test coverage detected