# Zendesk api secure proxy for customer portal

> Scoped edge pipeline returns only public-safe ticket fields. For "zendesk api secure proxy for customer portal", 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/zendesk-api-customer-portal-proxy with an rc_live_ client token.

- Canonical page: https://realcomposer.com/recipes/zendesk-api-customer-portal-proxy
- Client platform: Frontend / Web
- Upstream services: Zendesk
- Category: Security & Secret Vault
- JSON version: https://realcomposer.com/recipes/zendesk-api-customer-portal-proxy.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=zendesk-api-customer-portal-proxy&via=agent

## Problem: Zendesk keys in Frontend / Web network tabs

Frontend / Web ships code or scripts to end-user devices. Any Zendesk bearer token in those bundles can be copied from DevTools, proxies, or repackaged apps.

- Shared Frontend / Web projects revealing Zendesk tokens
- Sudden Zendesk quota burn from scripted abuse
- Inability to rotate keys without redeploying clients

## Solution steps

1. **Store upstream credentials in Secret Vault**: Create ZENDESK_API_TOKEN vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders.

2. **Configure upstream steps and output mapping**: Point step zendesk at https://{{secrets.ZENDESK_SUBDOMAIN}}.zendesk.com/api/v2/tickets.json with GET. Add output mapping fields that mirror the JSON contract your screen already expects. 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**: Allowed origins on the token should list every Frontend / Web host that calls this URL.

```
const res = await fetch('https://realcomposer.com/v1/workspace/zendesk-api-customer-portal-proxy', {
  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 api secure proxy for customer portal",
  "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/zendesk-api-customer-portal-proxy" \
  -H "Authorization: Bearer rc_live_client_token"
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_zendesk-",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "zendesk-api-customer-portal-proxy"
  },
  "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

### Which Zendesk credential belongs in the vault for this pipeline?

Store ZENDESK_API_TOKEN for zendesk-api-customer-portal-proxy. Frontend / Web never sees decrypted values.

### Does POST traffic get cached?

zendesk-api-customer-portal-proxy POST steps bypass caches.default even if cacheTtlSeconds is set in the dashboard.

### How do I rotate upstream credentials?

Allowed origins on the zendesk-api-customer-portal-proxy client token restrict which domains may call the edge URL.
