Skip to content

Commit 3dfe5d4

Browse files
authored
fix(bot): add Slack welcome disclosure (#2986)
1 parent 139e54d commit 3dfe5d4

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

apps/web/src/lib/bot.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ const SLACK_ASSISTANT_SUGGESTED_PROMPTS = [
3737

3838
const ASSISTANT_PROMPTS_TITLE = 'Try asking Kilo Bot';
3939

40+
const SLACK_CHANNEL_INVITE_MESSAGE = {
41+
markdown:
42+
"Hey, I'm Kilo, an AI coding assistant. Mention me in this channel when you want help investigating bugs, reviewing PRs, explaining code, or starting implementation work. AI can make mistakes, so please review responses before relying on them. Sessions created with Kilo from Slack are stored at https://app.kilo.ai.",
43+
} as const;
44+
4045
export function buildSlackAppHomeView() {
4146
return {
4247
type: 'home',
@@ -49,7 +54,7 @@ export function buildSlackAppHomeView() {
4954
type: 'section',
5055
text: {
5156
type: 'mrkdwn',
52-
text: 'Turn Slack messages into focused coding work. Ask Kilo to investigate bugs, review pull requests, explain code, or start a Cloud Agent session in your connected repositories.',
57+
text: "I'm Kilo, an AI coding assistant that turns Slack messages into focused coding work. Ask me to investigate bugs, review pull requests, explain code, or start a Cloud Agent session in your connected repositories. AI can make mistakes, so please review responses before relying on them. Sessions created with Kilo from Slack are stored at https://app.kilo.ai.",
5358
},
5459
},
5560
{
@@ -241,6 +246,25 @@ function createKiloBot(slackAdapter: ReturnType<typeof createSlackAdapter>) {
241246
}
242247
});
243248

249+
chatBot.onMemberJoinedChannel(async event => {
250+
if (!(event.adapter instanceof SlackAdapter)) return;
251+
if (event.userId !== event.adapter.botUserId) return;
252+
253+
try {
254+
await event.adapter.postMessage(event.channelId, SLACK_CHANNEL_INVITE_MESSAGE);
255+
} catch (error) {
256+
console.error('[Bot] Failed to post Slack channel invite message:', error);
257+
captureException(error, {
258+
tags: { component: 'kilo-bot', op: 'member-joined-channel' },
259+
extra: {
260+
channelId: event.channelId,
261+
inviterId: event.inviterId,
262+
userId: event.userId,
263+
},
264+
});
265+
}
266+
});
267+
244268
chatBot.onAppHomeOpened(async event => {
245269
if (!(event.adapter instanceof SlackAdapter)) return;
246270

0 commit comments

Comments
 (0)