Skip to content

Added Slack account linking and implemented private Slack channels creation for mentorship pairs#56

Open
mafernandag wants to merge 7 commits intomainfrom
slack-integration
Open

Added Slack account linking and implemented private Slack channels creation for mentorship pairs#56
mafernandag wants to merge 7 commits intomainfrom
slack-integration

Conversation

@mafernandag
Copy link
Collaborator

This PR introduces a complete Slack integration to enable seamless communication between the Mentorship App and existing Slack workspaces. It supports OAuth linking, admin channel management, and bi-directional message syncing for mentorship pairs. Closes #41.

⚠️ IMPORTANT: This feature has not yet been fully end-to-end tested locally. Verifying the "Private Channel" creation and message bridging requires two distinct Slack accounts (Mentor & Mentee) linked within the same workspace. This code is ready to be deployed to a staging environment where multi-user testing can be performed.

Key Features:

Authentication & Linking:

  • OAuth Flow: New endpoints to allow users to link their Slack accounts to their App profiles.
  • Token Storage: Securely stores Slack user IDs and access tokens in Firestore.

Admin Capabilities:

  • Backend Support for Channel Management: Added API endpoints and client functions to support future admin channel management features. (UI pending)

Mentorship Chat Sync (Two-Way Bridging):

  • Private Channels: Automatically creates a private Slack channel (e.g., #mentor-) for each mentorship match.
  • Auto-Invite: Automatically invites both the Mentor and Mentee (if linked) to this shared private channel.
  • Real-time Sync:
    • App → Slack: Messages sent in the App are posted to the private Slack channel.
    • Slack → App: Replies in the Slack channel are captured via Event Subscriptions and synced back to the App chat interface.

Infrastructure:

  • New Google Cloud Functions (slackEvents, slackBridgeMessages) to handle webhooks and API calls.
  • Robust error handling for missing scopes or unlinked users.

Copilot AI review requested due to automatic review settings December 22, 2025 23:18
@github-actions
Copy link

github-actions bot commented Dec 22, 2025

Visit the preview URL for this PR (updated for commit 59054ff):

https://mentor-match-backend--pr-56-txwh4zla.web.app

(expires Tue, 30 Dec 2025 20:10:35 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 00dcef695f9e3298930fa589c5484a93e0a376cb

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces comprehensive Slack integration to enable two-way communication between the Mentorship App and Slack workspaces. The implementation supports OAuth account linking, automatic private channel creation for mentorship pairs, and bidirectional message synchronization.

Key Changes:

  • OAuth flow for linking user Slack accounts with user tokens stored in Firestore
  • Automatic creation of private Slack channels for each mentorship pair with auto-invite functionality
  • Real-time message bridging using Socket.io for app-to-Slack and Slack-to-app synchronization
  • Admin API endpoints for manual channel management (UI pending)
  • Google Cloud Functions for handling Slack webhooks and message forwarding

Reviewed changes

Copilot reviewed 14 out of 17 changed files in this pull request and generated 21 comments.

Show a summary per file
File Description
functions/slack.js Core Slack integration logic including event handling, signature verification, channel creation, and message forwarding
functions/index.js OAuth callback endpoints and admin channel management routes integrated into Express API
functions/package.json Upgraded firebase-functions to v7.0.0 for enhanced functionality
src/components/dashboard/SlackPage.jsx UI component for Slack account linking with connection status display
src/components/SlackOAuthPage.jsx OAuth callback handler with popup window support and user refresh
src/components/dashboard/SideMenu.jsx Added Slack menu item with inline SVG icon
src/components/chat/Chat.jsx Socket.io integration for real-time Slack message sync and dual-send functionality
src/hooks/useUser.jsx Cross-window message listener for OAuth popup completion events
src/api/slackBridge.js Client-side API functions for posting messages and creating channels
src/api/firebaseConfig.js Enhanced test environment compatibility with conditional initialization
package.json Added dependencies: @slack/web-api, socket.io, socket.io-client, body-parser
App.jsx Added OAuth success route
.gitignore Added Slack server directory and local env files
Files not reviewed (2)
  • mentor-match-app/functions/package-lock.json: Language not supported
  • mentor-match-app/package-lock.json: Language not supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slack integration for messaging

2 participants