{
  "slug": "combine-intercom-with-clerk-users",
  "title": "Combine intercom users with clerk user metadata",
  "metaTitle": "Combine intercom users with clerk - RealComposer",
  "metaDescription": "Combine intercom users with clerk user metadata. Merge Intercom and Clerk in one React / Flutter / Mobile call with parallel Worker steps.",
  "headline": "Support sidebar with auth context",
  "category": "aggregation",
  "categoryLabel": "Multi-API Aggregation",
  "urgency": 9,
  "clientPlatform": "React / Flutter / Mobile",
  "upstreamServices": [
    "Intercom",
    "Clerk"
  ],
  "searchIntentQuery": "combine intercom users with clerk user metadata",
  "directAnswerSummary": "Clerk user profile and Intercom contact record stitched for in-app chat. For \"combine intercom users with clerk user metadata\", store INTERCOM_ACCESS_TOKEN, CLERK_SECRET_KEY in Secret Vault, call https://api.intercom.io/contacts from a Worker, and let React / Flutter / Mobile hit only https://realcomposer.com/v1/workspace/combine-intercom-with-clerk-users with an rc_live_ client token.",
  "problem": {
    "title": "Serial Intercom and Clerk calls slow React / Flutter / Mobile pages",
    "explanation": "Each extra Intercom and Clerk hop adds hundreds of milliseconds and another OAuth refresh path your UI must manage.",
    "risks": [
      "One slow upstream blocking an entire page",
      "Partial failures leaving UI in inconsistent states",
      "Duplicate auth refresh logic per service"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Store upstream credentials in Secret Vault",
      "description": "Create INTERCOM_ACCESS_TOKEN, CLERK_SECRET_KEY vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders."
    },
    {
      "stepNumber": 2,
      "title": "Configure upstream steps and output mapping",
      "description": "Use GET against https://api.intercom.io/contacts. Allowed origins on the client token should match 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 React / Flutter / Mobile",
      "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-intercom-with-clerk-users', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Combine intercom users with clerk user metadata",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "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
      },
      {
        "stepKey": "clerk",
        "upstreamUrlTemplate": "https://api.clerk.com/v1/users/{{query.userId}}",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.CLERK_SECRET_KEY}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "intercom.contactId",
          "sourcePath": "data.0.id",
          "type": "string",
          "sourceStep": "intercom"
        },
        {
          "targetPath": "intercom.email",
          "sourcePath": "data.0.email",
          "type": "string",
          "sourceStep": "intercom"
        },
        {
          "targetPath": "clerk.userId",
          "sourcePath": "id",
          "type": "string",
          "sourceStep": "clerk"
        },
        {
          "targetPath": "clerk.email",
          "sourcePath": "email_addresses.0.email_address",
          "type": "string",
          "sourceStep": "clerk"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_combine-",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "combine-intercom-with-clerk-users"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "intercom_contactId": "sample",
    "intercom_email": "sample",
    "clerk_userId": "sample",
    "clerk_email": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/combine-intercom-with-clerk-users\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Does React / Flutter / Mobile need CORS changes after adding RealComposer?",
      "answer": "Log request IDs for combine-intercom-with-clerk-users, not raw Intercom payloads, because upstream bodies may include PII."
    },
    {
      "question": "What cache key does RealComposer use?",
      "answer": "combine-intercom-with-clerk-users 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": "How do I rotate upstream credentials?",
      "answer": "Upstream steps in combine-intercom-with-clerk-users honor timeoutMs and optional fallback JSON without leaking secrets."
    }
  ],
  "relatedRecipeSlugs": [
    "merge-clerk-and-posthog-feature-flags",
    "clerk-backend-api-proxy"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/combine-intercom-with-clerk-users",
    "markdown": "https://realcomposer.com/recipes/combine-intercom-with-clerk-users.md",
    "json": "https://realcomposer.com/recipes/combine-intercom-with-clerk-users.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=combine-intercom-with-clerk-users&via=agent"
  }
}