{
  "slug": "merge-mailchimp-with-sendgrid-stats",
  "title": "Merge mailchimp campaigns with sendgrid stats",
  "metaDescription": "Merge mailchimp campaigns with sendgrid stats. Merge Mailchimp and SendGrid in one Frontend / Web call with parallel Worker steps.",
  "headline": "Email performance unified report",
  "category": "aggregation",
  "categoryLabel": "Multi-API Aggregation",
  "urgency": 8,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "Mailchimp",
    "SendGrid"
  ],
  "searchIntentQuery": "merge mailchimp campaigns with sendgrid stats",
  "directAnswerSummary": "Campaign metadata from Mailchimp plus delivery stats from SendGrid. For \"merge mailchimp campaigns with sendgrid stats\", store MAILCHIMP_BASIC_AUTH, SENDGRID_API_KEY in Secret Vault, call https://{{secrets.MAILCHIMP_DC}}.api.mailchimp.com/3.0/lists/{{query.listId}}/members?count=10 from a Worker, and let Frontend / Web hit only https://realcomposer.com/v1/workspace/merge-mailchimp-with-sendgrid-stats with an rc_live_ client token.",
  "problem": {
    "title": "Serial Mailchimp and SendGrid calls slow Frontend / Web pages",
    "explanation": "Each extra Mailchimp and SendGrid 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": "Add vault secrets for this pipeline",
      "description": "Create MAILCHIMP_BASIC_AUTH, SENDGRID_API_KEY vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders."
    },
    {
      "stepNumber": 2,
      "title": "Set headers, mapping, and cache TTL",
      "description": "Configure headersTemplate to inject vault secrets, target https://{{secrets.MAILCHIMP_DC}}.api.mailchimp.com/3.0/lists/{{query.listId}}/members?count=10, and Add output mapping fields that mirror the JSON contract your screen already expects."
    },
    {
      "stepNumber": 3,
      "title": "Call from Frontend / Web",
      "description": "Call https://realcomposer.com/v1/workspace/merge-mailchimp-with-sendgrid-stats with a restricted rc_live_ client token. Frontend / Web never sends upstream secrets.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/merge-mailchimp-with-sendgrid-stats', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Merge mailchimp campaigns with sendgrid stats",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "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": "sendgrid",
        "upstreamUrlTemplate": "https://api.sendgrid.com/v3/marketing/stats?start_date={{query.startDate}}",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.SENDGRID_API_KEY}}"
        },
        "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": "sendgrid.delivered",
          "sourcePath": "0.stats.0.metrics.delivered",
          "type": "number",
          "sourceStep": "sendgrid"
        },
        {
          "targetPath": "sendgrid.opens",
          "sourcePath": "0.stats.0.metrics.opens",
          "type": "number",
          "sourceStep": "sendgrid"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_merge-ma",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "merge-mailchimp-with-sendgrid-stats"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "mailchimp_memberId": "sample",
    "mailchimp_email": "sample",
    "sendgrid_delivered": "sample",
    "sendgrid_opens": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/merge-mailchimp-with-sendgrid-stats\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Does Frontend / Web need CORS changes after adding RealComposer?",
      "answer": "Store MAILCHIMP_BASIC_AUTH, SENDGRID_API_KEY for merge-mailchimp-with-sendgrid-stats. Frontend / Web never sees decrypted values."
    },
    {
      "question": "When does edge caching apply to this recipe?",
      "answer": "merge-mailchimp-with-sendgrid-stats 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": "Rotate vault secrets for merge-mailchimp-with-sendgrid-stats anytime; clients keep the same rc_live_ token."
    }
  ],
  "relatedRecipeSlugs": [
    "merge-airtable-and-sendgrid-templates",
    "sendgrid-frontend-proxy"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/merge-mailchimp-with-sendgrid-stats",
    "markdown": "https://realcomposer.com/recipes/merge-mailchimp-with-sendgrid-stats.md",
    "json": "https://realcomposer.com/recipes/merge-mailchimp-with-sendgrid-stats.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=merge-mailchimp-with-sendgrid-stats&via=agent"
  }
}