* Set status message for Assistant thread * Uses Slack's assistant.threads.setStatus API
(channelId: string, status: string)
| 900 | * Uses Slack's assistant.threads.setStatus API |
| 901 | */ |
| 902 | async function setAssistantStatus(channelId: string, status: string): Promise<void> { |
| 903 | const token = process.env.ADDIE_BOT_TOKEN || process.env.SLACK_BOT_TOKEN; |
| 904 | if (!token) return; |
| 905 | |
| 906 | const response = await fetch('https://slack.com/api/assistant.threads.setStatus', { |
| 907 | method: 'POST', |
| 908 | headers: { |
| 909 | 'Authorization': `Bearer ${token}`, |
| 910 | 'Content-Type': 'application/json', |
| 911 | }, |
| 912 | body: JSON.stringify({ |
| 913 | channel_id: channelId, |
| 914 | status, |
| 915 | }), |
| 916 | }); |
| 917 | |
| 918 | const data = await response.json() as { ok: boolean; error?: string }; |
| 919 | if (!data.ok && data.error !== 'not_in_channel') { |
| 920 | logger.debug({ error: data.error }, 'Addie: Failed to set status'); |
| 921 | } |
| 922 | } |
| 923 | |
| 924 | /** |
| 925 | * Send a proactive message when a user links their account |
no outgoing calls
no test coverage detected