Skip to content

Migrate from Slack notifications to email notifications and remove Slack integration #1075

@devin-ai-integration

Description

@devin-ai-integration

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 slackAlertChannel including:
    • 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 slackAlertChannel including:
    • 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 reports
  • slackBotToken (text) - Slack bot OAuth token
  • slackBotUserId (text) - Slack bot user ID
  • slackTeamId (text) - Slack workspace team ID
  • vipChannelId (text) - Channel for VIP notifications

Other tables with Slack fields:

  • conversationMessages.slackMessageTs - Timestamp of Slack message
  • conversationMessages.slackChannel - Slack channel ID
  • agentThreads.slackChannel - Slack channel for agent threads
  • agentThreads.threadTs - Slack thread timestamp
  • agentMessages.slackChannel - Slack channel for agent messages
  • agentMessages.messageTs - Slack message timestamp
  • faqs.slackMessageTs - Slack message for FAQ suggestions
  • notes.slackChannel - Slack channel for notes
  • notes.slackMessageTs - Slack message timestamp for notes

Files to Remove

Core Slack Integration:

  • lib/slack/ (entire directory)
    • client.ts
    • constants.ts
    • linkUnfurl.ts
    • shared.ts
    • vipNotifications.ts
    • agent/ (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.tsx
  • components/useShowToastForSlackConnectStatus.ts
  • packages/marketing/app/slackNotification.tsx
  • packages/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

  1. Create email templates for:

    • Daily summary reports
    • Weekly team performance reports
    • VIP customer notifications
    • Ticket response time alerts
    • Knowledge bank suggestion notifications
  2. 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
  3. Add email preferences:

    • Allow users to opt-in/opt-out of specific notification types
    • Store preferences in userProfiles table

Phase 2: Remove Slack Integration

  1. Remove all Slack-related code files
  2. Remove Slack-related database fields (create migration)
  3. Remove Slack-related API routes
  4. Remove Slack-related UI components
  5. Remove Slack-related tests
  6. Remove Slack-related environment variables from .env files
  7. Update documentation

Phase 3: Testing

  1. Test email notifications are sent correctly
  2. Test all existing functionality still works without Slack
  3. Verify no broken references to Slack code
  4. Run full test suite

Environment Variables to Remove

  • SLACK_CLIENT_ID
  • SLACK_CLIENT_SECRET
  • SLACK_SIGNING_SECRET

Dependencies to Remove

  • @slack/web-api (from package.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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions