|
| 1 | +--- |
| 2 | +sidebar_position: 4 |
| 3 | +--- |
| 4 | + |
| 5 | +# Zendesk |
| 6 | + |
| 7 | +Integration with Zendesk for retrieving user tickets. |
| 8 | + |
| 9 | +## Overview and prerequisites |
| 10 | + |
| 11 | +This integration allows users to view their Zendesk support tickets within the Open Self Service platform. It implements the Tickets service contract to retrieve tickets for a user from Zendesk using the Search API. |
| 12 | + |
| 13 | +### Requirements |
| 14 | + |
| 15 | +- Zendesk account with API access |
| 16 | +- API token with read-only access to tickets |
| 17 | + |
| 18 | +## Configuration |
| 19 | + |
| 20 | +Set the following environment variables: |
| 21 | + |
| 22 | +``` |
| 23 | +ZENDESK_API_URL=https://your-subdomain.zendesk.com |
| 24 | +ZENDESK_API_TOKEN=your-base64-encoded-token |
| 25 | +``` |
| 26 | + |
| 27 | +The token should be base64-encoded and will be sent in the header: `Authentication: Basic ${ZENDESK_API_TOKEN}`. |
| 28 | + |
| 29 | +## Data mapping |
| 30 | + |
| 31 | +### Zendesk to Tickets model |
| 32 | + |
| 33 | +| Zendesk field | Tickets model field | Notes | |
| 34 | +|---------------|---------------------|-------| |
| 35 | +| id | id | | |
| 36 | +| created_at | createdAt | ISO timestamp preserved | |
| 37 | +| updated_at | updatedAt | ISO timestamp preserved | |
| 38 | +| tags[0] | topic | First tag is used as topic | |
| 39 | +| priority | type | | |
| 40 | +| status | status | Mapped to OPEN, CLOSED, or IN_PROGRESS | |
| 41 | +| subject | properties[].value | Added as a property with id 'subject' | |
| 42 | +| description | properties[].value | Added as a property with id 'description' | |
| 43 | +| custom_fields | properties[] | Added as properties with id 'custom_field_X' | |
| 44 | + |
| 45 | +## Usage examples |
| 46 | + |
| 47 | +### Getting a list of tickets |
| 48 | + |
| 49 | +```typescript |
| 50 | +import { Tickets } from '@o2s/framework/modules'; |
| 51 | + |
| 52 | +@Injectable() |
| 53 | +export class YourService { |
| 54 | + constructor(private readonly ticketsService: Tickets.Service) {} |
| 55 | + |
| 56 | + getTickets() { |
| 57 | + return this.ticketsService.getTicketList({ |
| 58 | + limit: 10, |
| 59 | + offset: 0, |
| 60 | + status: 'OPEN', |
| 61 | + }); |
| 62 | + } |
| 63 | +} |
| 64 | +``` |
| 65 | + |
| 66 | +### Getting a specific ticket |
| 67 | + |
| 68 | +```typescript |
| 69 | +import { Tickets } from '@o2s/framework/modules'; |
| 70 | + |
| 71 | +@Injectable() |
| 72 | +export class YourService { |
| 73 | + constructor(private readonly ticketsService: Tickets.Service) {} |
| 74 | + |
| 75 | + getTicket(id: string) { |
| 76 | + return this.ticketsService.getTicket({ id }); |
| 77 | + } |
| 78 | +} |
| 79 | +``` |
| 80 | + |
| 81 | +## Limitations |
| 82 | + |
| 83 | +- Creating tickets is not implemented in this version |
| 84 | +- User identification is done by email address only |
| 85 | +- Pagination mapping: Zendesk uses page/per_page while our API uses offset/limit |
0 commit comments