-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Feature/freshdesk kb connector #4749
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
Feature/freshdesk kb connector #4749
Conversation
@bslavin is attempting to deploy a commit to the Danswer Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR introduces a Freshdesk Knowledge Base connector with multi-folder indexing capabilities, folder discovery tools, and comprehensive documentation. The implementation includes robust error handling and rate limiting mechanisms.
- Added new
FreshdeskKnowledgeBaseConnector
in/backend/onyx/connectors/freshdesk_kb/connector.py
with support for both single and multiple folder indexing - Implemented folder discovery utility in
/backend/onyx/connectors/freshdesk_kb/scripts/list_freshdesk_kb_folders.py
to help users identify available folders - Added canary document system in connector implementation to verify indexing success
- Enhanced error handling with detailed logging and recovery mechanisms for API failures
- Introduced credential validation and configuration options in web interface through updates to
/web/src/lib/connectors/connectors.tsx
and/web/src/lib/connectors/credentials.ts
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
12 file(s) reviewed, 8 comment(s)
Edit PR Review Bot Settings | Greptile
**List all folders across all categories:** | ||
```bash | ||
python standalone_list_freshdesk_folders.py --domain your-domain.freshdesk.com --api-key your-api-key --pretty | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: The standalone script path 'standalone_list_freshdesk_folders.py' doesn't match the script name shown in the backend path. This inconsistency could confuse users.
**List all folders across all categories:** | |
```bash | |
python standalone_list_freshdesk_folders.py --domain your-domain.freshdesk.com --api-key your-api-key --pretty | |
``` | |
**List all folders across all categories:** | |
```bash | |
python backend/onyx/connectors/freshdesk_kb/scripts/list_freshdesk_kb_folders.py --domain your-domain.freshdesk.com --api-key your-api-key --pretty |
```bash | ||
python list_category_folders.py --category-id YOUR_CATEGORY_ID | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: The 'list_category_folders.py' script is referenced but not included in the repository structure shown in the PR. Either include the script or remove this section.
- **Portal URL**: The URL of your Freshdesk portal (e.g., `https://support.your-company.com`) | ||
- **Portal ID**: The ID of your Freshdesk portal, used for agent URLs. You can find your Portal ID in the URL when you click on the "Solutions" button in Freshdesk - it will appear as `https://yourdomain.freshdesk.com/a/solutions?portalId=12345` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: The Portal ID example URL uses 'yourdomain.freshdesk.com' while earlier examples use 'company.freshdesk.com'. Keep domain examples consistent throughout the documentation.
import os | ||
import sys | ||
import json | ||
from typing import Dict, List, Any, Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Optional import not used in code
from typing import Dict, List, Any, Optional | |
from typing import Dict, List, Any |
logger.info(f"Starting to yield documents from Freshdesk KB folder: {self.folder_id}") | ||
yield from self._process_articles(self.folder_id) | ||
|
||
def poll_source(self, start: SecondsSinceUnixEpoch, end: SecondsSinceUnixEpoch) -> GenerateDocumentsOutput: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: poll_source ignores the end parameter, which could lead to processing unnecessary updates
test_freshdesk_kb_connector.py
Outdated
portal_id = credentials.get("freshdesk_portal_id") # For constructing agent URLs | ||
|
||
# Check credentials | ||
if not all(cred for cred in [domain, api_key, folder_id] if cred is not None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Credential validation could miss empty strings - use if not cred
instead of relying on all(cred)
if not all(cred for cred in [domain, api_key, folder_id] if cred is not None): | |
if not all(bool(cred) for cred in [domain, api_key, folder_id] if cred is not None): |
test_freshdesk_kb_connector.py
Outdated
source="freshdesk_kb", | ||
semantic_identifier=title, | ||
metadata=metadata, | ||
doc_updated_at=datetime.fromisoformat(article["updated_at"].replace("Z", "+00:00")) if article.get("updated_at") else datetime.now(timezone.utc), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Potential timezone handling issue when article['updated_at'] is missing - using now() could cause inconsistencies in document timestamps
freshdesk_folder_id: "Freshdesk Knowledge Base Folder ID", | ||
freshdesk_portal_url: "Freshdesk Portal URL", | ||
freshdesk_portal_id: "Freshdesk Portal ID", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: freshdesk_folder_id display name is added but not present in the FreshdeskKBCredentialJson interface - this may cause confusion
- Remove references to non-existent standalone scripts in README - Fix inconsistent domain examples (use company.freshdesk.com consistently) - Remove unused Optional import from script - Remove unused freshdesk_folder_id from credential display names - Improve credential validation to handle empty strings
033a721
to
4c36533
Compare
- Remove test/canary documents from indexing process - Fix document creation to properly handle metadata and dates - Reduce excessive debug logging - Fix syntax error in validation method - Clean up error handling for production use These changes address the issues found during PR review and ensure the connector is production-ready. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add FRESHDESK_KB to DocumentSource enum - Register FreshdeskKnowledgeBaseConnector in factory - Add UI configuration for freshdesk_kb connector - Add freshdesk_kb to ValidSources and source metadata 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove unused imports (json, logging) - Add missing __init__.py to scripts directory - These changes should help fix mypy and quality check failures 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Format long logger.error() calls to multiple lines - This should fix the pre-commit hook failures 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add 'from __future__ import annotations' to support lowercase dict/list type hints - This fixes compatibility with Python < 3.9 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Break long lines to stay under 88 characters - Format multi-line function calls and string literals - Use consistent quote style (double quotes) - Fix import grouping and formatting - Apply standard Python formatting conventions
- Add type annotation for **kwargs parameter - Fix folder_ids type annotation to support both str and List[str] - Initialize response variable before try blocks to fix undefined errors - Make portal_url and portal_id parameters Optional in helper functions - Remove perm_sync_data parameter from SlimDocument (uses default) - Fix IndexingHeartbeatInterface usage: use progress() not heartbeat() - Format remaining logger.error calls for quality checks
- Check if response is not None before accessing attributes - Properly handle None case to satisfy mypy type checker
- Reorder imports according to reorder-python-imports requirements - Separate imports from same module to individual lines - Sort imports alphabetically within each group - Follow Python import conventions: future, stdlib, third-party, local
- Remove docstring from __init__.py as it causes issues with import reordering - Follow pattern of other __init__.py files in the project
- Add trailing comma after **kwargs parameter - Remove trailing space after self parameter - Fix line lengths in list_freshdesk_kb_folders.py - Use double quotes consistently - Format long argument lists
- Remove test_freshdesk_kb_connector.py that was accidentally left in root - This file was causing Black formatting checks to fail
- Black formatting adjustments - Import reordering via reorder-python-imports - Ruff style fixes - Prettier formatting for non-Python files
- Remove unnecessary f-string prefix per ruff linter
- Remove test files that are causing mypy errors - Remove Vespa configuration files - Remove UI components unrelated to Freshdesk KB connector - Remove YouTrack JSON sample files
- Fix docstring formatting (remove trailing spaces) - Break long lines for better readability - Fix import and blank line spacing - Apply consistent formatting throughout
- Run Black formatter on all connector files - Fix all formatting issues to pass CI checks
- Format connectors.tsx with proper line breaks - Add trailing comma in credentials.ts
Hi maintainers! 👋 I've addressed all the CI failures:
The PR is now ready for review. The failing integration tests appear to be pre-existing issues unrelated to this Freshdesk KB connector implementation (they're failing due to missing credentials for other connectors). Please let me know if you need any other changes! |
This PR is stale because it has been open 75 days with no activity. Remove stale label or comment or this will be closed in 15 days. |
This PR was closed because it has been stalled for 90 days with no activity. |
Description
Adding support for the Freshdesk Knowledge Base connector to Onyx. This connector allows indexing of Freshdesk KB articles for search and retrieval.
How Has This Been Tested?
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.
No Linear Ticket - External Contribution