{
  "slug": "cache-salesforce-composite-mobile-dashboard",
  "title": "Salesforce composite api cache mobile dashboard",
  "metaTitle": "Salesforce composite api cache - RealComposer",
  "metaDescription": "Salesforce composite api cache mobile dashboard. Shield Salesforce with 120s GET edge cache; cache key uses query params on.",
  "headline": "Sales rep mobile home with fewer API calls",
  "category": "caching",
  "categoryLabel": "Edge Caching & Rate Limits",
  "urgency": 8,
  "clientPlatform": "React Native",
  "upstreamServices": [
    "Salesforce"
  ],
  "searchIntentQuery": "salesforce composite api cache mobile dashboard",
  "directAnswerSummary": "Composite read responses cached per user id at edge. For \"salesforce composite api cache mobile dashboard\", store SALESFORCE_ACCESS_TOKEN in Secret Vault, call https://{{secrets.SALESFORCE_INSTANCE}}.my.salesforce.com/services/data/v68.0/sobjects/Contact/{{query.contactId}} from a Worker, and let React Native hit only https://realcomposer.com/v1/workspace/cache-salesforce-composite-mobile-dashboard with an rc_live_ client token. Enable 120s GET cache only when query params identify the resource.",
  "problem": {
    "title": "Uncached Salesforce spikes cost and latency",
    "explanation": "Every React Native visitor can trigger a fresh Salesforce call. Bursts exhaust per-minute quotas even when data changes slowly.",
    "risks": [
      "Thundering herds after cache expiry on the origin",
      "Analytics skewed by client-side retry storms",
      "Support tickets blaming \"API downtime\" during spikes"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Store upstream credentials in Secret Vault",
      "description": "Add SALESFORCE_ACCESS_TOKEN to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream."
    },
    {
      "stepNumber": 2,
      "title": "Configure upstream steps and output mapping",
      "description": "Configure headersTemplate to inject vault secrets, target https://{{secrets.SALESFORCE_INSTANCE}}.my.salesforce.com/services/data/v68.0/sobjects/Contact/{{query.contactId}}, and Add output mapping fields that mirror the JSON contract your screen already expects."
    },
    {
      "stepNumber": 3,
      "title": "Call from React Native",
      "description": "Allowed origins on the token should list every React Native host that calls this URL.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/cache-salesforce-composite-mobile-dashboard', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Salesforce composite api cache mobile dashboard",
    "method": "GET",
    "cacheTtlSeconds": 120,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "salesforce",
        "upstreamUrlTemplate": "https://{{secrets.SALESFORCE_INSTANCE}}.my.salesforce.com/services/data/v68.0/sobjects/Contact/{{query.contactId}}",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.SALESFORCE_ACCESS_TOKEN}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "contactId",
          "sourcePath": "Id",
          "type": "string",
          "sourceStep": "salesforce"
        },
        {
          "targetPath": "email",
          "sourcePath": "Email",
          "type": "string",
          "sourceStep": "salesforce"
        },
        {
          "targetPath": "name",
          "sourcePath": "Name",
          "type": "string",
          "sourceStep": "salesforce"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_cache-sa",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "cache-salesforce-composite-mobile-dashboard"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "contactId": "sample",
    "email": "sample",
    "name": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/cache-salesforce-composite-mobile-dashboard\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Is it safe to log Salesforce responses in React Native?",
      "answer": "Use scoped tokens where the vendor allows them on cache-salesforce-composite-mobile-dashboard. Admin keys stay {{secrets.*}} references only."
    },
    {
      "question": "When does edge caching apply to this recipe?",
      "answer": "cache-salesforce-composite-mobile-dashboard: only GET requests cache (120s on caches.default). Key is workspace slug plus sorted query params, not Authorization."
    },
    {
      "question": "What happens if an upstream step times out?",
      "answer": "Allowed origins on the cache-salesforce-composite-mobile-dashboard client token restrict which domains may call the edge URL."
    }
  ],
  "relatedRecipeSlugs": [
    "sub-10ms-api-for-mobile-apps",
    "trim-salesforce-json-for-mobile"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/cache-salesforce-composite-mobile-dashboard",
    "markdown": "https://realcomposer.com/recipes/cache-salesforce-composite-mobile-dashboard.md",
    "json": "https://realcomposer.com/recipes/cache-salesforce-composite-mobile-dashboard.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=cache-salesforce-composite-mobile-dashboard&via=agent"
  }
}