# Merge Airtable and Shopify into One API Response

> Instead of Frontend / Web firing serial fetches to Airtable and Shopify, one pipeline hits https://api.airtable.com/v0/{{query.baseId}}/{{query.tableName}}?maxRecords=5 (and sibling steps) in parallel and returns mapped JSON.

- Canonical page: https://realcomposer.com/recipes/merge-airtable-and-shopify
- Client platform: Frontend / Web
- Upstream services: Airtable, Shopify
- Category: Multi-API Aggregation
- JSON version: https://realcomposer.com/recipes/merge-airtable-and-shopify.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=merge-airtable-and-shopify&via=agent

## Problem: Waterfall latency from multiple Airtable and Shopify requests

Frontend / Web widgets often await Airtable and Shopify sequentially, multiplying TLS handshakes on cellular networks and amplifying failure rates.

- Race conditions between parallel manual fetches
- Higher mobile data usage from redundant JSON
- Timeouts when any upstream exceeds cellular RTT

## Solution steps

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

2. **Target the real upstream URL**: Point step airtable at https://api.airtable.com/v0/{{query.baseId}}/{{query.tableName}}?maxRecords=5 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**: Call https://realcomposer.com/v1/workspace/merge-airtable-and-shopify with a restricted rc_live_ client token. Frontend / Web never sends upstream secrets.

```
const res = await fetch('https://realcomposer.com/v1/workspace/merge-airtable-and-shopify', {
  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": "Merge Airtable and Shopify into One API Response",
  "method": "GET",
  "cacheTtlSeconds": 0,
  "authMode": "client_token",
  "steps": [
    {
      "stepKey": "airtable",
      "upstreamUrlTemplate": "https://api.airtable.com/v0/{{query.baseId}}/{{query.tableName}}?maxRecords=5",
      "httpMethod": "GET",
      "headersTemplate": {
        "Authorization": "Bearer {{secrets.AIRTABLE_PAT}}"
      },
      "timeoutMs": 3000
    },
    {
      "stepKey": "shopify",
      "upstreamUrlTemplate": "https://{{secrets.SHOPIFY_STORE}}.myshopify.com/admin/api/2026-10/products.json?limit=5",
      "httpMethod": "GET",
      "headersTemplate": {
        "X-Shopify-Access-Token": "{{secrets.SHOPIFY_ACCESS_TOKEN}}"
      },
      "timeoutMs": 3000
    }
  ],
  "outputMapping": {
    "version": 1,
    "fields": [
      {
        "targetPath": "airtable.recordId",
        "sourcePath": "records.0.id",
        "type": "string",
        "sourceStep": "airtable"
      },
      {
        "targetPath": "airtable.fields",
        "sourcePath": "records.0.fields",
        "type": "object",
        "sourceStep": "airtable"
      },
      {
        "targetPath": "shopify.productId",
        "sourcePath": "products.0.id",
        "type": "number",
        "sourceStep": "shopify"
      },
      {
        "targetPath": "shopify.title",
        "sourcePath": "products.0.title",
        "type": "string",
        "sourceStep": "shopify"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X GET "https://realcomposer.com/v1/workspace/merge-airtable-and-shopify" \
  -H "Authorization: Bearer rc_live_client_token"
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_merge-ai",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "merge-airtable-and-shopify"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
```

Slimmed RealComposer response:

```json
{
  "airtable_recordId": "sample",
  "airtable_fields": "sample",
  "shopify_productId": "sample",
  "shopify_title": "sample"
}
```

## FAQ

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

Yes for merge-airtable-and-shopify. Ship only an rc_live_ client token in Frontend / Web; RealComposer injects AIRTABLE_PAT on https://api.airtable.com/v0/{{query.baseId}}/{{query.tableName}}?maxRecords=5.

### What cache key does RealComposer use?

merge-airtable-and-shopify POST steps bypass caches.default even if cacheTtlSeconds is set in the dashboard.

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

Rotate vault secrets for merge-airtable-and-shopify anytime; clients keep the same rc_live_ token.
