-
Notifications
You must be signed in to change notification settings - Fork 262
Labels
Description
Overview
Currently, Helper sends notifications to team members via Slack for various events including:
- Daily summary reports (tickets answered, open tickets, average reply times, VIP metrics)
- Weekly team performance reports
- VIP customer message notifications
- Ticket response time alerts
This issue tracks the migration from Slack notifications to email notifications, and the complete removal of the Slack integration from the codebase.
Current Slack Integration Points
1. Daily Reports (jobs/generateDailyReports.ts)
- Sends daily summary to
slackAlertChannelincluding:- Open tickets count
- Tickets answered in last 24h
- Open tickets over $0
- Tickets answered over $0
- Average reply time
- VIP average reply time
- Average time open tickets have been open
2. Weekly Reports (jobs/generateWeeklyReports.ts)
- Sends weekly team performance reports to
slackAlertChannelincluding:- Individual team member reply counts (with Slack mentions)
- Total replies from all team members
- List of inactive team members
3. VIP Notifications (jobs/notifyVipMessage.ts, lib/slack/vipNotifications.ts)
- Posts VIP customer messages to
vipChannelId - Updates Slack messages when agents reply
- Includes action buttons (Respond, Assign, Close)
4. Ticket Response Time Alerts (jobs/checkAssignedTicketResponseTimes.ts, jobs/checkVipResponseTimes.ts)
- Sends alerts when tickets exceed expected response times
5. Slack Agent Integration (lib/slack/agent/)
- Allows agents to interact with Helper through Slack
- Handles messages, threads, and actions
- Generates AI responses in Slack threads
6. Interactive Actions (lib/slack/shared.ts)
- Respond to tickets from Slack
- Assign tickets from Slack
- Close tickets from Slack
- Add notes from Slack
7. Link Unfurling (lib/slack/linkUnfurl.ts)
- Automatically expands Helper conversation links in Slack
8. Knowledge Bank Suggestions (lib/data/knowledge.ts)
- Sends suggested FAQ edits to Slack for approval
Database Schema Changes Required
mailboxes table fields to remove:
slackAlertChannel(text) - Channel for daily/weekly reportsslackBotToken(text) - Slack bot OAuth tokenslackBotUserId(text) - Slack bot user IDslackTeamId(text) - Slack workspace team IDvipChannelId(text) - Channel for VIP notifications
Other tables with Slack fields:
conversationMessages.slackMessageTs- Timestamp of Slack messageconversationMessages.slackChannel- Slack channel IDagentThreads.slackChannel- Slack channel for agent threadsagentThreads.threadTs- Slack thread timestampagentMessages.slackChannel- Slack channel for agent messagesagentMessages.messageTs- Slack message timestampfaqs.slackMessageTs- Slack message for FAQ suggestionsnotes.slackChannel- Slack channel for notesnotes.slackMessageTs- Slack message timestamp for notes
Files to Remove
Core Slack Integration:
lib/slack/(entire directory)client.tsconstants.tslinkUnfurl.tsshared.tsvipNotifications.tsagent/(entire subdirectory)
API Routes:
app/api/webhooks/slack/(entire directory)app/api/connect/slack/(entire directory)
Jobs:
jobs/handleSlackAgentMessage.ts
UI Components:
app/(dashboard)/settings/integrations/slackSetting.tsxcomponents/useShowToastForSlackConnectStatus.tspackages/marketing/app/slackNotification.tsxpackages/marketing/app/slackInterface.tsx
Tests:
tests/app/api/webhooks/slack/(entire directory)tests/lib/slack/(entire directory)tests/trpc/router/mailbox/slack.test.ts
tRPC Routers:
trpc/router/mailbox/slack.ts
Implementation Plan
Phase 1: Email Notification System
-
Create email templates for:
- Daily summary reports
- Weekly team performance reports
- VIP customer notifications
- Ticket response time alerts
- Knowledge bank suggestion notifications
-
Implement email sending logic:
- Use existing email infrastructure (likely via Gmail integration or transactional email service)
- Send to all team members in the workspace
- Include relevant links to Helper dashboard
-
Add email preferences:
- Allow users to opt-in/opt-out of specific notification types
- Store preferences in
userProfilestable
Phase 2: Remove Slack Integration
- Remove all Slack-related code files
- Remove Slack-related database fields (create migration)
- Remove Slack-related API routes
- Remove Slack-related UI components
- Remove Slack-related tests
- Remove Slack-related environment variables from
.envfiles - Update documentation
Phase 3: Testing
- Test email notifications are sent correctly
- Test all existing functionality still works without Slack
- Verify no broken references to Slack code
- Run full test suite
Environment Variables to Remove
SLACK_CLIENT_IDSLACK_CLIENT_SECRETSLACK_SIGNING_SECRET
Dependencies to Remove
@slack/web-api(frompackage.json)
Migration Notes
- Existing Slack data in the database can be left as-is (nullable fields)
- No data migration needed for existing records
- Users will need to be notified about the change from Slack to email notifications
Success Criteria
- All daily/weekly reports are sent via email to team members
- VIP notifications are sent via email
- All Slack code is removed from the codebase
- All Slack database fields are removed
- All tests pass
- No references to Slack remain in the codebase
- Documentation is updated