Skip to content

Conversation

@manojag115
Copy link
Contributor

@manojag115 manojag115 commented Jan 9, 2026

Description

Add Microsoft Teams connector to surfsense.
The implementation is very similar to Slack and Discourse Connectors.

Motivation and Context

FIX #147

Screenshots

Screenshot 2026-01-08 at 3 43 30 PM Screenshot 2026-01-08 at 5 15 16 PM

See above screenshots for celery worker logs and ui being able to search through teams messages
Steps followed:

  • Add new connector, choose Teams, follow steps to add, make sure your app on azure gives required permissions for the graph api
  • Index Teams connector
  • Tested chat, selected teams connector
  • Also run the db migration using alembic

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

High-level PR Summary

This PR adds a Microsoft Teams connector to SurfSense, enabling users to search and index messages from Teams channels. The implementation follows the existing connector patterns (similar to Slack and Discord) and includes OAuth authentication using Microsoft Graph API, message indexing with date range filtering, token encryption and refresh, database migrations to add TEAMS_CONNECTOR enum values, backend APIs for OAuth flow and indexing, and frontend UI components for connector configuration. The connector supports automatic token refresh, duplicate detection, incremental indexing, and hybrid search for Teams messages.

⏱️ Estimated Review Time: 30-90 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_backend/app/db.py
2 surfsense_backend/alembic/versions/59_add_teams_connector_enums.py
3 surfsense_backend/app/schemas/teams_auth_credentials.py
4 surfsense_backend/app/config/__init__.py
5 surfsense_backend/.env.example
6 surfsense_backend/app/routes/teams_add_connector_route.py
7 surfsense_backend/app/connectors/teams_connector.py
8 surfsense_backend/app/connectors/teams_history.py
9 surfsense_backend/app/tasks/connector_indexers/teams_indexer.py
10 surfsense_backend/app/tasks/celery_tasks/connector_tasks.py
11 surfsense_backend/app/routes/search_source_connectors_routes.py
12 surfsense_backend/app/routes/__init__.py
13 surfsense_backend/app/services/connector_service.py
14 surfsense_backend/app/agents/new_chat/tools/knowledge_base.py
15 surfsense_backend/app/utils/connector_naming.py
16 surfsense_backend/app/utils/periodic_scheduler.py
17 surfsense_web/contracts/enums/connector.ts
18 surfsense_web/contracts/types/connector.types.ts
19 surfsense_web/contracts/enums/connectorIcons.tsx
20 surfsense_web/components/assistant-ui/connector-popup/constants/connector-constants.ts
21 surfsense_web/components/assistant-ui/connector-popup/utils/connector-document-mapping.ts
22 surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/teams-config.tsx
23 surfsense_web/components/assistant-ui/connector-popup/connector-configs/index.tsx
24 .vscode/settings.json
⚠️ Inconsistent Changes Detected
File Path Warning
.vscode/settings.json Addition of 'python-envs.pythonProjects' setting appears to be an unrelated IDE configuration change that's not part of the Microsoft Teams connector feature.

Need help? Join our Discord

Analyze latest changes

@vercel
Copy link

vercel bot commented Jan 9, 2026

Someone is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

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

Review by RecurseML

🔍 Review performed on 609fc87..2b074b9

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (24)

.vscode/settings.json
surfsense_backend/.env.example
surfsense_backend/alembic/versions/59_add_teams_connector_enums.py
surfsense_backend/app/agents/new_chat/tools/knowledge_base.py
surfsense_backend/app/config/__init__.py
surfsense_backend/app/connectors/teams_connector.py
surfsense_backend/app/connectors/teams_history.py
surfsense_backend/app/db.py
surfsense_backend/app/routes/__init__.py
surfsense_backend/app/routes/search_source_connectors_routes.py
surfsense_backend/app/routes/teams_add_connector_route.py
surfsense_backend/app/schemas/teams_auth_credentials.py
surfsense_backend/app/services/connector_service.py
surfsense_backend/app/tasks/celery_tasks/connector_tasks.py
surfsense_backend/app/tasks/connector_indexers/teams_indexer.py
surfsense_backend/app/utils/connector_naming.py
surfsense_backend/app/utils/periodic_scheduler.py
surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/teams-config.tsx
surfsense_web/components/assistant-ui/connector-popup/connector-configs/index.tsx
surfsense_web/components/assistant-ui/connector-popup/constants/connector-constants.ts
surfsense_web/components/assistant-ui/connector-popup/utils/connector-document-mapping.ts
surfsense_web/contracts/enums/connector.ts
surfsense_web/contracts/enums/connectorIcons.tsx
surfsense_web/contracts/types/connector.types.ts

@manojag115 manojag115 marked this pull request as ready for review January 9, 2026 03:20
@MODSetter
Copy link
Owner

@manojag115 Looks good to me. Nice Work.

@MODSetter MODSetter merged commit 8a2715e into MODSetter:dev Jan 9, 2026
7 of 11 checks passed
Copy link

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

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

Review by RecurseML

🔍 Review performed on 2b074b9..fed9d73

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (1)

.vscode/settings.json

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.

2 participants