# Cache intercom api responses for help center

> Edge cache article list JSON for global readers. For "cache intercom api responses for help center", store INTERCOM_ACCESS_TOKEN in Secret Vault, call https://api.intercom.io/contacts from a Worker, and let Static HTML / Jamstack hit only https://realcomposer.com/v1/workspace/cache-intercom-api-help-center with an rc_live_ client token. Enable 600s GET cache only when query params identify the resource.

- Canonical page: https://realcomposer.com/recipes/cache-intercom-api-help-center
- Client platform: Static HTML / Jamstack
- Upstream services: Intercom
- Category: Edge Caching & Rate Limits
- JSON version: https://realcomposer.com/recipes/cache-intercom-api-help-center.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=cache-intercom-api-help-center&via=agent

## Problem: Intercom rate limits from Static HTML / Jamstack traffic

Without edge caching, identical Intercom reads during a session still round-trip to the origin.

- HTTP 429 responses during launch traffic
- Surprise SaaS overages from duplicate reads
- Slower repeat views than necessary

## Solution steps

1. **Store upstream credentials in Secret Vault**: Store INTERCOM_ACCESS_TOKEN in the vault. Static HTML / Jamstack never embeds the raw secret, only a revocable rc_live_ client token.

2. **Configure upstream steps and output mapping**: Configure headersTemplate to inject vault secrets, target https://api.intercom.io/contacts, and Add output mapping fields that mirror the JSON contract your screen already expects.

3. **Call from Static HTML / Jamstack**: Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.

```
fetch('https://realcomposer.com/v1/workspace/cache-intercom-api-help-center', {
  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": "Cache intercom api responses for help center",
  "method": "GET",
  "cacheTtlSeconds": 600,
  "authMode": "client_token",
  "steps": [
    {
      "stepKey": "intercom",
      "upstreamUrlTemplate": "https://api.intercom.io/contacts",
      "httpMethod": "GET",
      "headersTemplate": {
        "Authorization": "Bearer {{secrets.INTERCOM_ACCESS_TOKEN}}",
        "Accept": "application/json"
      },
      "timeoutMs": 3000
    }
  ],
  "outputMapping": {
    "version": 1,
    "fields": [
      {
        "targetPath": "contactId",
        "sourcePath": "data.0.id",
        "type": "string",
        "sourceStep": "intercom"
      },
      {
        "targetPath": "email",
        "sourcePath": "data.0.email",
        "type": "string",
        "sourceStep": "intercom"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X GET "https://realcomposer.com/v1/workspace/cache-intercom-api-help-center" \
  -H "Authorization: Bearer rc_live_client_token"
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_cache-in",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "cache-intercom-api-help-center"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
```

Slimmed RealComposer response:

```json
{
  "contactId": "sample",
  "email": "sample"
}
```

## FAQ

### What should Static HTML / Jamstack store instead of Intercom secrets?

Yes for cache-intercom-api-help-center. Ship only an rc_live_ client token in Static HTML / Jamstack; RealComposer injects INTERCOM_ACCESS_TOKEN on https://api.intercom.io/contacts.

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

Cache key for cache-intercom-api-help-center: internal edge-cache path plus sorted query. Identical params hit; vary userId per user.

### How do I rotate upstream credentials?

Upstream steps in cache-intercom-api-help-center honor timeoutMs and optional fallback JSON without leaking secrets.
