-
Notifications
You must be signed in to change notification settings - Fork 32
feat: integrate Zendesk articles and categories #623
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
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
1a2a2d4
feat(zendesk): integrate Help Center API and enhance article management
c27a4b0
feat(zendesk): integrate Help Center API and enhance article management
62aa509
feat(zendesk): enhance article mapping and attachment handling
16eb290
feat(zendesk): add author information and avatar handling in article …
a8cdd0f
feat(cms): add Zendesk category blocks and pages
b4ecd09
refactor(zendesk): update category slugs and enhance locale handling
e3ce761
fix: merge main into branch
57f0642
refactor(zendesk): update path resolution to use dirname and fileURLT…
417668a
refactor(zendesk): update articles to use mocked integration
ebe6982
feat(zendesk): integrate html-to-text for lead extraction in article …
93af48d
feat(cms): add Zendesk warranty and maintenance pages to alternative …
4530912
feat(articles):implement Zendesk article search functionality
f24cded
fix(articles): correct search payload locale handling and total artic…
f7f7dec
Merge branch 'main' into feature/OSS-308-integrate-articles
974aaa1
fix(ui): improve prop handling in `RichText` component
marcinkrasowski d7006f0
refactor(zendesk): remove deprecated generated files and update .giti…
819cbd6
Merge remote-tracking branch 'origin/feature/OSS-308-integrate-articl…
21bf23a
feat(articles): add mapping function for search articles
a5b387e
feat(zendesk): add author mapping function and simplify body parsing …
1037907
refactor(articles): simplify getCategory method by removing defer and…
7f44ab7
refactor(zendesk): optimize article data retrieval by replacing Promi…
056f29c
feat(ui): add figure support to RichText component with customizable …
993c8cb
fix(zendesk): update article count handling to use Zendesk API's count
72c3abe
refactor(zendesk): remove unused mapArticles function from article ma…
fcd2e93
feat(zendesk): add initial documentation for Zendesk Help Center inte…
461a4a2
chore: add changeset for minor updates and integrate Zendesk Help Cen…
02abffa
feat(zendesk): implement transformation of Zendesk article links to i…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| '@o2s/blocks.category-list': minor | ||
| '@o2s/configs.integrations': minor | ||
| '@o2s/integrations.zendesk': minor | ||
| '@o2s/blocks.article-list': minor | ||
| '@o2s/integrations.mocked': minor | ||
| '@o2s/framework': minor | ||
| '@o2s/ui': minor | ||
| '@o2s/docs': minor | ||
| --- | ||
|
|
||
| add Zendesk Help Center articles integration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "label": "Articles", | ||
| "position": 260, | ||
| "link": { | ||
| "type": "generated-index" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "label": "Zendesk", | ||
| "position": 100, | ||
| "link": { | ||
| "type": "doc", | ||
| "id": "overview" | ||
| } | ||
| } |
201 changes: 201 additions & 0 deletions
201
apps/docs/docs/integrations/articles/zendesk/features.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,201 @@ | ||
| --- | ||
| sidebar_position: 200 | ||
| --- | ||
|
|
||
| # Features | ||
|
|
||
| This page provides an overview of the features and capabilities provided by the Zendesk Help Center integration. | ||
|
|
||
| ## Core functionality | ||
|
|
||
| The Zendesk Help Center integration implements the framework's `Articles.Service` interface, providing knowledge base functionality that works with the Zendesk Help Center API. | ||
|
|
||
| ## Features | ||
|
|
||
| The Zendesk Help Center integration provides: | ||
|
|
||
| - **Viewing individual articles** - Retrieve full article details including content, author, and attachments | ||
| - **Listing articles** - Get a list of articles with optional category filtering and pagination | ||
| - **Viewing categories** - Retrieve category details with localized content | ||
| - **Listing categories** - Get all available categories | ||
| - **Searching articles** - Full-text search across articles with filters | ||
| - **Multi-language support** - Automatic locale mapping (en → en-us, de → de-de, pl → pl) | ||
| - **Data normalization** - Automatic conversion of Zendesk data structures to the standard article model | ||
| - **Author information** - Fetch author details for articles | ||
| - **Attachment handling** - Extract images and attachments from articles | ||
|
|
||
| ## Supported ArticleService Methods | ||
|
|
||
| The following table shows which methods from the base ArticleService are currently supported by the Zendesk integration: | ||
|
|
||
| | Method | Description | Supported | | ||
| | --------------- | --------------------------------------------- | --------- | | ||
| | getArticle | Retrieve a single article by slug/ID | ✓ | | ||
| | getArticleList | Retrieve a list of articles with filtering | ✓ | | ||
| | getCategory | Retrieve a single category by ID or slug | ✓ | | ||
| | getCategoryList | Retrieve a list of categories | ✓ | | ||
| | searchArticles | Search articles with query and filters | ✓ | | ||
|
|
||
| ## Module Structure | ||
|
|
||
| The Zendesk Help Center integration is structured into several components: | ||
|
|
||
| ### 1. API Client Generation | ||
|
|
||
| The integration uses an automated process to generate TypeScript types and API client methods from the Zendesk OpenAPI specification: | ||
|
|
||
| - **Source**: Fetches OpenAPI specification from Zendesk | ||
| - **Tool**: Uses `@hey-api/openapi-ts` to generate TypeScript types | ||
| - **Output**: Generated files are placed in `generated/help-center` directory | ||
| - **Automation**: Scripts run automatically during `npm run prepare` | ||
|
|
||
| **Available scripts:** | ||
|
|
||
| ```shell | ||
| # Fetch the latest OpenAPI specification | ||
| npm run fetch-oas | ||
|
|
||
| # Generate TypeScript types and API client | ||
| npm run generate-types | ||
| ``` | ||
|
|
||
| These scripts are automatically run during the package preparation phase, ensuring that the API client is always up-to-date with the latest Zendesk API. | ||
|
|
||
| ### 2. Article Service | ||
|
|
||
| The `ZendeskArticleService` handles: | ||
|
|
||
| - **Authentication** - Configures API client with Base64-encoded token | ||
| - **Locale mapping** - Converts application locales to Zendesk format | ||
| - **Article retrieval** - Fetches articles with sections, attachments, and author info | ||
| - **Category resolution** - Resolves category IDs from slugs or numeric IDs | ||
| - **Search** - Implements full-text search with category filtering | ||
| - **Error handling** - Gracefully handles 404 errors and missing data | ||
|
|
||
| ### 3. Data Normalization | ||
|
|
||
| The integration automatically converts Zendesk-specific data structures to the standard article model: | ||
|
|
||
| - Maps Zendesk fields to normalized article properties | ||
| - Converts HTML body to article sections | ||
| - Extracts lead text from article body | ||
| - Builds localized slugs with category paths | ||
| - Processes attachments for images and thumbnails | ||
| - Handles author information with avatars | ||
|
|
||
| ## Locale Mapping | ||
|
|
||
| The integration automatically maps application locales to Zendesk Help Center format: | ||
|
|
||
| | Application Locale | Zendesk Locale | | ||
| | ------------------ | -------------- | | ||
| | en | en-us | | ||
| | de | de-de | | ||
| | pl | pl | | ||
|
|
||
| This mapping is applied automatically when making API requests to ensure proper locale-specific content is returned. | ||
|
|
||
| ## Module Configuration | ||
|
|
||
| The integration exports the following components: | ||
|
|
||
| - **Service** - `ZendeskArticleService` implementing `Articles.Service` | ||
| - **Module** - `ZendeskArticleModule` for NestJS dependency injection | ||
|
|
||
| The integration is configured with: | ||
|
|
||
| ```typescript | ||
| { | ||
| name: 'zendesk', | ||
| service: ZendeskArticleService, | ||
| imports: [HttpModule] | ||
| } | ||
| ``` | ||
|
|
||
| ## Data Normalization | ||
|
|
||
| The integration maps Zendesk article data to the standard article model with the following transformations: | ||
|
|
||
| ### Field Mapping | ||
|
|
||
| | Zendesk Field | Normalized Field | Notes | | ||
| | ----------------- | ---------------- | ------------------------------------------ | | ||
| | id | id | Converted to string | | ||
| | created_at | createdAt | ISO date string | | ||
| | updated_at | updatedAt | ISO date string | | ||
| | title | title | Article title | | ||
| | body | sections | Parsed into ArticleSectionText | | ||
| | body (excerpt) | lead | First 300 characters of plain text | | ||
| | label_names | tags | Article labels/tags | | ||
| | html_url | slug | Extracted and combined with category slug | | ||
| | author_id | author | Fetched separately with avatar | | ||
| | section_id | category | Resolved via section → category lookup | | ||
|
|
||
| ### Category Field Mapping | ||
|
|
||
| | Zendesk Field | Normalized Field | Notes | | ||
| | ------------- | ---------------- | --------------------------------- | | ||
| | id | id | Converted to string | | ||
| | created_at | createdAt | ISO date string | | ||
| | updated_at | updatedAt | ISO date string | | ||
| | name | title | Category name | | ||
| | description | description | Category description | | ||
| | html_url | slug | Full path with locale base | | ||
|
|
||
| ### Slug Generation | ||
|
|
||
| Article slugs are generated following this pattern: | ||
|
|
||
| ``` | ||
| /{locale-base}/{category-id}-{category-name}/{article-id}-{article-title} | ||
| ``` | ||
|
|
||
| **Locale bases:** | ||
| - English: `/help-and-support` | ||
| - German: `/hilfe-und-support` | ||
| - Polish: `/pomoc-i-wsparcie` | ||
|
|
||
| **Example:** | ||
| ``` | ||
| /help-and-support/12345-Maintenance/67890-Tool-Care-Guide | ||
| ``` | ||
|
|
||
| ### Article Sections | ||
|
|
||
| Article body content is converted into sections: | ||
|
|
||
| - **ArticleSectionText** - HTML content from article body | ||
| - Images embedded in HTML are preserved inline | ||
| - Attachments are processed for featured images and thumbnails | ||
|
|
||
| ### Image Handling | ||
|
|
||
| The integration extracts images from article attachments: | ||
|
|
||
| - **Featured image**: First non-inline attachment, fallback to first inline | ||
| - **Thumbnail**: First inline attachment, fallback to first non-inline | ||
| - Images must have `content_type` starting with `image/` | ||
|
|
||
| ### Author Mapping | ||
|
|
||
| When fetching article author: | ||
|
|
||
| - Uses Zendesk Ticketing API to fetch user details | ||
| - Extracts avatar from `photo.content_url` or `remote_photo_url` | ||
| - Maps role to position field | ||
|
|
||
| ## Zendesk Help Center Structure | ||
|
|
||
| Understanding Zendesk Help Center hierarchy: | ||
|
|
||
| ``` | ||
| Help Center | ||
| ├── Categories (e.g., "Help and Support") | ||
| │ ├── Sections (e.g., "Maintenance", "Warranty") | ||
| │ │ └── Articles (e.g., "Tool Care Guide") | ||
| ``` | ||
|
|
||
| The integration: | ||
| 1. Fetches articles with their section IDs | ||
| 2. Resolves section → category relationship | ||
| 3. Builds proper slugs with category information | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.