* /aao status - Check subscription status
(command: SlackSlashCommand)
| 118 | * /aao status - Check subscription status |
| 119 | */ |
| 120 | async function handleStatusCommand(command: SlackSlashCommand): Promise<CommandResponse> { |
| 121 | try { |
| 122 | // Look up user mapping |
| 123 | const mapping = await slackDb.getBySlackUserId(command.user_id); |
| 124 | |
| 125 | if (!mapping || !mapping.workos_user_id) { |
| 126 | return { |
| 127 | response_type: 'ephemeral', |
| 128 | text: 'Your Slack account is not linked to an AAO account', |
| 129 | blocks: [ |
| 130 | { |
| 131 | type: 'section', |
| 132 | text: { |
| 133 | type: 'mrkdwn', |
| 134 | text: ':warning: *Your Slack account is not linked to an AAO account*', |
| 135 | }, |
| 136 | }, |
| 137 | { |
| 138 | type: 'section', |
| 139 | text: { |
| 140 | type: 'mrkdwn', |
| 141 | text: 'To check your status, first link your Slack account to your AAO account.\n\nUse `/aao link` for instructions, or sign up at <https://agenticadvertising.org|agenticadvertising.org>', |
| 142 | }, |
| 143 | }, |
| 144 | ], |
| 145 | }; |
| 146 | } |
| 147 | |
| 148 | // Get all organizations for this user |
| 149 | const userOrgs = await getOrganizationsForUser(mapping.workos_user_id); |
| 150 | |
| 151 | if (userOrgs.length === 0) { |
| 152 | return { |
| 153 | response_type: 'ephemeral', |
| 154 | text: 'Account linked but no organizations found', |
| 155 | blocks: [ |
| 156 | { |
| 157 | type: 'section', |
| 158 | text: { |
| 159 | type: 'mrkdwn', |
| 160 | text: ':link: *Account Linked*', |
| 161 | }, |
| 162 | }, |
| 163 | { |
| 164 | type: 'section', |
| 165 | fields: [ |
| 166 | { |
| 167 | type: 'mrkdwn', |
| 168 | text: `*Slack Account:*\n${command.user_name}`, |
| 169 | }, |
| 170 | { |
| 171 | type: 'mrkdwn', |
| 172 | text: `*AAO Account:*\nLinked`, |
| 173 | }, |
| 174 | ], |
| 175 | }, |
| 176 | { |
| 177 | type: 'section', |
no test coverage detected