{
  "slug": "combine-multiple-webhooks-into-one-payload",
  "title": "How to Combine Multiple REST Webhooks into One Payload",
  "metaTitle": "Combine Multiple REST Webhooks into - RealComposer",
  "metaDescription": "How to combine multiple rest webhooks into one payload. Merge REST API in one Frontend / Web call with parallel Worker steps.",
  "headline": "Parallel REST API fetch merged before Frontend / Web hydrates",
  "category": "aggregation",
  "categoryLabel": "Multi-API Aggregation",
  "urgency": 8,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "REST API"
  ],
  "searchIntentQuery": "how to combine multiple rest webhooks into one payload",
  "directAnswerSummary": "Instead of Frontend / Web firing serial fetches to REST API, one pipeline hits https://jsonplaceholder.typicode.com/users/{{query.userId}} (and sibling steps) in parallel and returns mapped JSON.",
  "problem": {
    "title": "Waterfall latency from multiple REST API requests",
    "explanation": "Frontend / Web widgets often await REST API sequentially, multiplying TLS handshakes on cellular networks and amplifying failure rates.",
    "risks": [
      "Race conditions between parallel manual fetches",
      "Higher mobile data usage from redundant JSON",
      "Timeouts when any upstream exceeds cellular RTT"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Store upstream credentials in Secret Vault",
      "description": "Add API_BEARER_TOKEN to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream."
    },
    {
      "stepNumber": 2,
      "title": "Set headers, mapping, and cache TTL",
      "description": "Point step upstream at https://jsonplaceholder.typicode.com/users/{{query.userId}} 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)."
    },
    {
      "stepNumber": 3,
      "title": "Call from Frontend / Web",
      "description": "Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/combine-multiple-webhooks-into-one-payload', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "How to Combine Multiple REST Webhooks into One Payload",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "upstream",
        "upstreamUrlTemplate": "https://jsonplaceholder.typicode.com/users/{{query.userId}}",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.API_BEARER_TOKEN}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "userId",
          "sourcePath": "id",
          "type": "number",
          "sourceStep": "upstream"
        },
        {
          "targetPath": "name",
          "sourcePath": "name",
          "type": "string",
          "sourceStep": "upstream"
        },
        {
          "targetPath": "email",
          "sourcePath": "email",
          "type": "string",
          "sourceStep": "upstream"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_combine-",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "combine-multiple-webhooks-into-one-payload"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "userId": "sample",
    "name": "sample",
    "email": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/combine-multiple-webhooks-into-one-payload\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Can Frontend / Web call REST API without holding the production key?",
      "answer": "Store API_BEARER_TOKEN for combine-multiple-webhooks-into-one-payload. Frontend / Web never sees decrypted values."
    },
    {
      "question": "Does POST traffic get cached?",
      "answer": "combine-multiple-webhooks-into-one-payload keeps cache TTL at 0 because it uses POST upstream calls or per-user responses. Add ids to query strings before enabling GET cache."
    },
    {
      "question": "Can I restrict which domains call this pipeline?",
      "answer": "Allowed origins on the combine-multiple-webhooks-into-one-payload client token restrict which domains may call the edge URL."
    }
  ],
  "relatedRecipeSlugs": [
    "merge-linear-and-github-pr-api",
    "merge-clerk-and-posthog-feature-flags",
    "plaid-api-proxy-flutter"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/combine-multiple-webhooks-into-one-payload",
    "markdown": "https://realcomposer.com/recipes/combine-multiple-webhooks-into-one-payload.md",
    "json": "https://realcomposer.com/recipes/combine-multiple-webhooks-into-one-payload.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=combine-multiple-webhooks-into-one-payload&via=agent"
  }
}