Skip to content

feat: creating zendesk tickets#550

Closed
lukasz-hycom wants to merge 10 commits intomainfrom
feature/creating-zendesk-tickets
Closed

feat: creating zendesk tickets#550
lukasz-hycom wants to merge 10 commits intomainfrom
feature/creating-zendesk-tickets

Conversation

@lukasz-hycom
Copy link
Copy Markdown
Contributor

@lukasz-hycom lukasz-hycom commented Jan 16, 2026

What does this PR do?

  • implemented createTicket method from Zendesk API

Key Changes

  • adding the option to create tickets with description and attachments

Summary by CodeRabbit

  • New Features

    • Tickets: add file attachments and new classification fields — topic, priority (urgent|high|normal|low), and type (question|problem|incident|task).
    • Tickets: enable full end-to-end creation with external ticketing integration and automatic requester resolution.
  • Stability / UX

    • Product details and recommended products: refined server-side data fetching for more consistent rendering and error handling.

✏️ Tip: You can customize this high-level summary in your review settings.

@lukasz-hycom lukasz-hycom self-assigned this Jan 16, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
o2s-docs Skipped Skipped Jan 16, 2026 2:40pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 16, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds attachment and metadata fields to the ticket request contract and implements a full Zendesk ticket creation flow: input validation, optional attachment uploads, user resolution by email, ticket creation with custom fields, and mapping Zendesk responses to the internal ticket model.

Changes

Cohort / File(s) Summary
Framework Request Contract
packages/framework/src/modules/tickets/tickets.request.ts
Added TicketAttachmentInput (filename, content, contentType) and extended PostTicketBody with topic: string, optional attachments: TicketAttachmentInput[], optional priority: string, and optional type: string.
Zendesk Ticket Service Implementation
packages/integrations/zendesk/src/modules/tickets/zendesk-ticket.service.ts
Replaced stub with full createTicket flow: validates input, resolves user by email, uploads attachments via HttpService (parallel), constructs Zendesk payload (subject, description, optional priority/type, optional topic as custom_field), creates ticket, maps Zendesk response to internal model. Adds baseUrl/authToken config, HttpService injection, and helpers uploadAttachment & findZendeskUserByEmail.
Frontend server components (minor refactor)
packages/blocks/product-details/src/frontend/ProductDetails.server.tsx, packages/blocks/recommended-products/src/frontend/RecommendedProducts.server.tsx
Refactored server components to assign fetched data to a local variable and perform a single final render after try/catch; no public API changes.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Service as ZendeskService
    participant Users as UsersService
    participant Zendesk as ZendeskAPI
    participant HTTP as HttpService

    Client->>Service: createTicket(PostTicketBody, authorization?)
    activate Service
    Service->>Service: validate input (title/description/topic)
    Service->>Users: resolve user by authorization (email)
    activate Users
    Users-->>Service: user email (or none)
    deactivate Users

    alt attachments present
        Service->>HTTP: upload attachment(s) (parallel)
        activate HTTP
        HTTP-->>Service: upload token(s)/identifiers
        deactivate HTTP
    end

    Service->>Zendesk: find user by email (searchUsers)
    activate Zendesk
    Zendesk-->>Service: zendesk user id (or none)
    deactivate Zendesk

    Service->>Zendesk: create ticket (subject, description, priority/type, custom_fields/topic, uploads, requester)
    activate Zendesk
    Zendesk-->>Service: created ticket data (comments, authors)
    deactivate Zendesk

    Service-->>Client: mapped internal ticket response
    deactivate Service
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • marcinkrasowski

Poem

🐰 I hopped through lines of code so bright,

Attachments packed and topics tight,
I fetched a user, sent a file,
Zendesk smiled across the mile,
A rabbit cheers — tickets take flight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete, missing critical sections like Related Ticket(s), detailed Key Changes explanation, and How to test steps required by the template. Add Related Ticket(s) section with ticket number, expand Key Changes with specific details about validation and attachment handling, and provide step-by-step testing instructions including environment setup.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main objective of the PR—implementing Zendesk ticket creation functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@packages/integrations/zendesk/src/modules/tickets/zendesk-ticket.service.ts`:
- Around line 368-372: The users.find email comparison in the map callback
should be case-insensitive to avoid missing matches; update the matching logic
used where matchedUser is computed (the users.find((u) => u.email === email)
expression) to compare u.email and email after normalizing both (e.g.,
toLowerCase()) and guard against undefined emails so the function returns a
correct matchedUser even when Zendesk returns lowercased or differently-cased
addresses.
- Around line 199-208: The code currently drops data.topic when
ZENDESK_TOPIC_FIELD_ID is unset (topicFieldId === 0); update the logic in the
ticket creation flow that builds customFields (referencing
ZENDESK_TOPIC_FIELD_ID, topicFieldId, customFields, and data.topic) to either 1)
throw a clear configuration error when data.topic is provided but
ZENDESK_TOPIC_FIELD_ID is not set (fail-fast), or 2) add a safe fallback such as
appending the topic to tags or a separate fallback field so the value is
persisted; implement one approach consistently and return or surface the error
so callers cannot silently lose topic values.
- Around line 390-401: The uploadAttachment method's axios.post call lacks a
timeout; update the axios request in uploadAttachment to include a timeout value
read from an environment variable (e.g., process.env.ZENDESK_UPLOAD_TIMEOUT)
with a sensible default fallback, and pass it into the axios options object so
uploads cannot hang indefinitely; ensure the change targets the axios.post
invocation in uploadAttachment and validate the env var is parsed to a number
before use.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd6bb5c and 11a0a79.

📒 Files selected for processing (2)
  • packages/framework/src/modules/tickets/tickets.request.ts
  • packages/integrations/zendesk/src/modules/tickets/zendesk-ticket.service.ts
🧰 Additional context used
🧬 Code graph analysis (1)
packages/integrations/zendesk/src/modules/tickets/zendesk-ticket.service.ts (2)
packages/framework/src/modules/tickets/tickets.request.ts (1)
  • PostTicketBody (15-20)
packages/integrations/zendesk/src/modules/tickets/zendesk-ticket.mapper.ts (1)
  • mapTicketToModel (7-91)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: deploy-preview
🔇 Additional comments (3)
packages/framework/src/modules/tickets/tickets.request.ts (1)

9-19: DTO updates for attachments/topic look good.

Clear, minimal additions that align with the new ticket creation flow.

packages/integrations/zendesk/src/modules/tickets/zendesk-ticket.service.ts (2)

1-19: Imports aligned with the new create-ticket flow.

Looks consistent with the new functionality.


37-53: Zendesk client config wiring looks solid.

Env-backed base URL and auth token setup is clean.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread packages/integrations/zendesk/src/modules/tickets/zendesk-ticket.service.ts Outdated
@vercel vercel Bot temporarily deployed to Preview – o2s-docs January 16, 2026 11:48 Inactive
@vercel vercel Bot temporarily deployed to Preview – o2s-docs January 16, 2026 11:53 Inactive
@marcinkrasowski marcinkrasowski self-requested a review January 16, 2026 12:25
@vercel vercel Bot temporarily deployed to Preview – o2s-docs January 16, 2026 13:02 Inactive
Comment thread packages/integrations/zendesk/src/modules/tickets/zendesk-ticket.service.ts Outdated
Comment thread packages/integrations/zendesk/src/modules/tickets/zendesk-ticket.service.ts Outdated
Comment thread packages/integrations/zendesk/src/modules/tickets/zendesk-ticket.service.ts Outdated
Comment thread packages/integrations/zendesk/src/modules/tickets/zendesk-ticket.service.ts Outdated
Comment thread packages/integrations/zendesk/src/modules/tickets/zendesk-ticket.service.ts Outdated
@vercel vercel Bot temporarily deployed to Preview – o2s-docs January 16, 2026 14:40 Inactive
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