feat: creating zendesk tickets#550
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughAdds 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
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ 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. Comment |
… feature/creating-zendesk-tickets
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
packages/framework/src/modules/tickets/tickets.request.tspackages/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.
…tachment to use httpClient
…using specific exceptions
… feature/creating-zendesk-tickets
What does this PR do?
Key Changes
Summary by CodeRabbit
New Features
Stability / UX
✏️ Tip: You can customize this high-level summary in your review settings.