# Zendesk ticket form api from static html no backend

> POST pipeline creates Zendesk requests with vault token. For "zendesk ticket form api from static html no backend", store ZENDESK_API_TOKEN in Secret Vault, call https://{{secrets.ZENDESK_SUBDOMAIN}}.zendesk.com/api/v2/tickets.json from a Worker, and let Static HTML / Astro hit only https://realcomposer.com/v1/workspace/zendesk-ticket-form-static-html-proxy with an rc_live_ client token.

- Canonical page: https://realcomposer.com/recipes/zendesk-ticket-form-static-html-proxy
- Client platform: Static HTML / Astro
- Upstream services: Zendesk
- Category: Platforms & Frameworks
- JSON version: https://realcomposer.com/recipes/zendesk-ticket-form-static-html-proxy.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=zendesk-ticket-form-static-html-proxy&via=agent

## Problem: Static HTML / Astro cannot attach secret headers to Zendesk

Static HTML / Astro runs in the browser or a sandbox without a secret store. Zendesk rejects unsigned browser origins or requires server-only headers.

- Proxy hacks that break when vendors tighten CSP
- Zapier-only workarounds adding cost and latency
- Guest users seeing failed network requests in demos

## Solution steps

1. **Add vault secrets for this pipeline**: Create ZENDESK_API_TOKEN vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders.

2. **Target the real upstream URL**: 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 Static HTML / Astro**: Call https://realcomposer.com/v1/workspace/zendesk-ticket-form-static-html-proxy with a restricted rc_live_ client token. Static HTML / Astro never sends upstream secrets.

```
await fetch('https://realcomposer.com/v1/workspace/zendesk-ticket-form-static-html-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 ticket form api from static html no backend",
  "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-ticket-form-static-html-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-ticket-form-static-html-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

### Can Static HTML / Astro call Zendesk without holding the production key?

Log request IDs for zendesk-ticket-form-static-html-proxy, not raw Zendesk payloads, because upstream bodies may include PII.

### How do I forward JSON bodies to POST upstreams?

zendesk-ticket-form-static-html-proxy keeps cache TTL at 0 because it uses POST upstream calls or per-user responses. Add ids to query strings before enabling GET cache.

### How do I rotate upstream credentials?

Upstream steps in zendesk-ticket-form-static-html-proxy honor timeoutMs and optional fallback JSON without leaking secrets.
