Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve ux of deep linked app dm πŸ’¬ #519

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions packages/core/src/modules/slack/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { track } from '@/modules/mixpanel';
import { sendSlackNotification } from '@/modules/notification/use-cases/send-slack-notification';
import { getPineconeIndex } from '@/modules/pinecone';
import { slack } from '@/modules/slack/instances';
import { fail, type Result, success } from '@/shared/utils/core.utils';

// Constants
Expand Down Expand Up @@ -212,9 +213,10 @@ export async function answerPublicQuestionInPrivate({
}

const message = [
`I saw your question in <#${channelId}>:`,
`You asked a great question in <#${channelId}>!`,
`>${question}`,
"I'll respond in this thread shortly! 🧡",
'Take a look at my answer in this thread! πŸ‘€',
"_I'm a ColorStack AI assistant! DM me a question in this channel and I'll answer it using the full history of our Slack workspace!_",
].join(BLANK_LINE);

// We're doing this synchronously so that we can get the ID of the message
Expand All @@ -225,18 +227,12 @@ export async function answerPublicQuestionInPrivate({
workspace: 'regular',
});

job(
'notification.slack.send',
{
channel: userId,
message: answerResult.data,
threadId: notificationTs,
workspace: 'regular',
},
{
delay: 1000 * 2, // Give the impression that we're "thinking"...
}
);
job('notification.slack.send', {
channel: userId,
message: answerResult.data,
threadId: notificationTs,
workspace: 'regular',
});

track({
application: 'Slack',
Expand Down Expand Up @@ -400,12 +396,14 @@ export async function answerPublicQuestion({
return success({});
}

const { team_id } = await slack.auth.test();

const message =
'I found some threads in our workspace that _may_ be relevant to your question! 🧡' +
'\n\n' +
threads.join('\n') +
'\n\n' +
`_I'm a ColorStack AI assistant! DM me a question <https://colorstack-family.slack.com/app_redirect?app=A04UHP3CKUZ|*here*> and I'll answer it using the full context of our Slack workspace!_`;
`_I'm a ColorStack AI assistant! DM me a question <slack://user?team=${team_id}&id=U04TYGYMKQE|*here*> and I'll answer it using the full context of our Slack workspace!_`;

job('notification.slack.send', {
channel: channelId,
Expand Down