# Zendesk user json filter for customer directory

> External id name email only for customer lookup tables. For "zendesk user json filter for customer directory", store ZENDESK_API_TOKEN in Secret Vault, call https://{{secrets.ZENDESK_SUBDOMAIN}}.zendesk.com/api/v2/tickets.json from a Worker, and let Frontend / Web hit only https://realcomposer.com/v1/workspace/filter-zendesk-user-json-directory with an rc_live_ client token.

- Canonical page: https://realcomposer.com/recipes/filter-zendesk-user-json-directory
- Client platform: Frontend / Web
- Upstream services: Zendesk
- Category: Payload Slimmer
- JSON version: https://realcomposer.com/recipes/filter-zendesk-user-json-directory.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=filter-zendesk-user-json-directory&via=agent

## Problem: Unmapped Zendesk fields waste bandwidth

Zendesk returns nested CRM, audit, and configuration objects. Frontend / Web parses them on the main thread even when the UI binds three fields.

- Large arrays kept in memory after navigation
- Analytics showing poor LCP on API-heavy screens
- Developers shipping defensive null checks for unused paths

## Solution steps

1. **Bind vault keys to the Worker**: Add ZENDESK_API_TOKEN to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream.

2. **Target the real upstream URL**: Point step zendesk at https://{{secrets.ZENDESK_SUBDOMAIN}}.zendesk.com/api/v2/tickets.json with GET. Map only the UI fields in output mapping so clients never download audit or nested blobs. Leave cache TTL at 0 when each response is user-specific (include userId or record id in query params before enabling cache).

3. **Call from Frontend / Web**: Call https://realcomposer.com/v1/workspace/filter-zendesk-user-json-directory with a restricted rc_live_ client token. Frontend / Web never sends upstream secrets.

```
const res = await fetch('https://realcomposer.com/v1/workspace/filter-zendesk-user-json-directory', {
  headers: { Authorization: 'Bearer rc_live_your_token' }
});
```

## Pipeline config

Import this config into a RealComposer pipeline. `{{secrets.NAME}}` values are read from the encrypted Secret Vault at request time, so the client never sees them.

```json
{
  "name": "Zendesk user json filter for customer directory",
  "method": "GET",
  "cacheTtlSeconds": 0,
  "authMode": "client_token",
  "steps": [
    {
      "stepKey": "zendesk",
      "upstreamUrlTemplate": "https://{{secrets.ZENDESK_SUBDOMAIN}}.zendesk.com/api/v2/tickets.json",
      "httpMethod": "GET",
      "headersTemplate": {
        "Authorization": "Bearer {{secrets.ZENDESK_API_TOKEN}}"
      },
      "timeoutMs": 3000
    }
  ],
  "outputMapping": {
    "version": 1,
    "fields": [
      {
        "targetPath": "ticketId",
        "sourcePath": "tickets.0.id",
        "type": "number",
        "sourceStep": "zendesk"
      },
      {
        "targetPath": "subject",
        "sourcePath": "tickets.0.subject",
        "type": "string",
        "sourceStep": "zendesk"
      },
      {
        "targetPath": "status",
        "sourcePath": "tickets.0.status",
        "type": "string",
        "sourceStep": "zendesk"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X GET "https://realcomposer.com/v1/workspace/filter-zendesk-user-json-directory" \
  -H "Authorization: Bearer rc_live_client_token"
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_filter-z",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "filter-zendesk-user-json-directory"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
```

Slimmed RealComposer response:

```json
{
  "ticketId": "sample",
  "subject": "sample",
  "status": "sample"
}
```

## FAQ

### Is it safe to log Zendesk responses in Frontend / Web?

Point Frontend / Web at /recipes/filter-zendesk-user-json-directory edge URL. RealComposer answers OPTIONS with Access-Control headers for allowed origins.

### Will Anthropic or Linear prompt bodies be rewritten?

filter-zendesk-user-json-directory keeps cache TTL at 0 because it uses POST upstream calls or per-user responses. Add ids to query strings before enabling GET cache.

### What happens if an upstream step times out?

Rotate vault secrets for filter-zendesk-user-json-directory anytime; clients keep the same rc_live_ token.
