{
  "slug": "mailchimp-hubspot-shared-edge-cache",
  "title": "Mailchimp and hubspot combined cache layer",
  "metaDescription": "Mailchimp and hubspot combined cache layer. Shield Mailchimp and HubSpot with 300s GET edge cache; cache key uses query params on.",
  "headline": "Internal dashboards with one cached audience view",
  "category": "caching",
  "categoryLabel": "Edge Caching & Rate Limits",
  "urgency": 7,
  "clientPlatform": "Retool",
  "upstreamServices": [
    "Mailchimp",
    "HubSpot"
  ],
  "searchIntentQuery": "mailchimp and hubspot combined cache layer",
  "directAnswerSummary": "Compose and cache merged marketing audience JSON. For \"mailchimp and hubspot combined cache layer\", store MAILCHIMP_BASIC_AUTH, HUBSPOT_ACCESS_TOKEN in Secret Vault, call https://{{secrets.MAILCHIMP_DC}}.api.mailchimp.com/3.0/lists/{{query.listId}}/members?count=10 from a Worker, and let Retool hit only https://realcomposer.com/v1/workspace/mailchimp-hubspot-shared-edge-cache with an rc_live_ client token. Enable 300s GET cache only when query params identify the resource.",
  "problem": {
    "title": "Mailchimp and HubSpot rate limits from Retool traffic",
    "explanation": "Without edge caching, identical Mailchimp and HubSpot reads during a session still round-trip to the origin.",
    "risks": [
      "HTTP 429 responses during launch traffic",
      "Surprise SaaS overages from duplicate reads",
      "Slower repeat views than necessary"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Add vault secrets for this pipeline",
      "description": "Create MAILCHIMP_BASIC_AUTH, HUBSPOT_ACCESS_TOKEN vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders."
    },
    {
      "stepNumber": 2,
      "title": "Target the real upstream URL",
      "description": "Use GET against https://{{secrets.MAILCHIMP_DC}}.api.mailchimp.com/3.0/lists/{{query.listId}}/members?count=10. Allowed origins on the client token should match set cache ttl to 300s so repeat gets with the same query string hit caches.default."
    },
    {
      "stepNumber": 3,
      "title": "Query from Retool",
      "description": "Allowed origins on the token should list every Retool host that calls this URL.",
      "codeSnippet": "// REST resource or JS query\nconst rows = await fetch('https://realcomposer.com/v1/workspace/mailchimp-hubspot-shared-edge-cache', {\n  headers: { Authorization: 'Bearer rc_live_token' }\n}).then(r => r.json());"
    }
  ],
  "pipelineConfig": {
    "name": "Mailchimp and hubspot combined cache layer",
    "method": "GET",
    "cacheTtlSeconds": 300,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "mailchimp",
        "upstreamUrlTemplate": "https://{{secrets.MAILCHIMP_DC}}.api.mailchimp.com/3.0/lists/{{query.listId}}/members?count=10",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Basic {{secrets.MAILCHIMP_BASIC_AUTH}}"
        },
        "timeoutMs": 3000
      },
      {
        "stepKey": "hubspot",
        "upstreamUrlTemplate": "https://api.hubapi.com/crm/v3/objects/contacts/{{query.contactId}}",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.HUBSPOT_ACCESS_TOKEN}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "mailchimp.memberId",
          "sourcePath": "members.0.id",
          "type": "string",
          "sourceStep": "mailchimp"
        },
        {
          "targetPath": "mailchimp.email",
          "sourcePath": "members.0.email_address",
          "type": "string",
          "sourceStep": "mailchimp"
        },
        {
          "targetPath": "hubspot.contactId",
          "sourcePath": "id",
          "type": "string",
          "sourceStep": "hubspot"
        },
        {
          "targetPath": "hubspot.email",
          "sourcePath": "properties.email",
          "type": "string",
          "sourceStep": "hubspot"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_mailchim",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "mailchimp-hubspot-shared-edge-cache"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "mailchimp_memberId": "sample",
    "mailchimp_email": "sample",
    "hubspot_contactId": "sample",
    "hubspot_email": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/mailchimp-hubspot-shared-edge-cache\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Is it safe to log Mailchimp responses in Retool?",
      "answer": "Store MAILCHIMP_BASIC_AUTH, HUBSPOT_ACCESS_TOKEN for mailchimp-hubspot-shared-edge-cache. Retool never sees decrypted values."
    },
    {
      "question": "When does edge caching apply to this recipe?",
      "answer": "mailchimp-hubspot-shared-edge-cache vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body."
    },
    {
      "question": "Can I restrict which domains call this pipeline?",
      "answer": "Rotate vault secrets for mailchimp-hubspot-shared-edge-cache anytime; clients keep the same rc_live_ token."
    }
  ],
  "relatedRecipeSlugs": [
    "merge-mailchimp-with-hubspot-contacts",
    "reduce-third-party-api-costs-caching"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/mailchimp-hubspot-shared-edge-cache",
    "markdown": "https://realcomposer.com/recipes/mailchimp-hubspot-shared-edge-cache.md",
    "json": "https://realcomposer.com/recipes/mailchimp-hubspot-shared-edge-cache.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=mailchimp-hubspot-shared-edge-cache&via=agent"
  }
}