# Mailchimp subscribe api from framer contact form

> Real-time subscribe via edge instead of polling automation. For "mailchimp subscribe api from framer contact form", store MAILCHIMP_BASIC_AUTH in Secret Vault, call https://{{secrets.MAILCHIMP_DC}}.api.mailchimp.com/3.0/lists/{{query.listId}}/members?count=10 from a Worker, and let Framer hit only https://realcomposer.com/v1/workspace/mailchimp-subscribe-framer-contact-form with an rc_live_ client token.

- Canonical page: https://realcomposer.com/recipes/mailchimp-subscribe-framer-contact-form
- Client platform: Framer
- Upstream services: Mailchimp
- Category: Platforms & Frameworks
- JSON version: https://realcomposer.com/recipes/mailchimp-subscribe-framer-contact-form.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=mailchimp-subscribe-framer-contact-form&via=agent

## Problem: CORS blocks Mailchimp in Framer

Low-code Framer tools expose connector tokens in shared workspaces, so Mailchimp credentials leak to every editor.

- Browser console CORS errors blocking launches
- Editors pasting secrets into reusable components
- Inability to test locally without disabling security

## Solution steps

1. **Add vault secrets for this pipeline**: Store MAILCHIMP_BASIC_AUTH in the vault. Framer never embeds the raw secret, only a revocable rc_live_ client token.

2. **Target the real upstream URL**: 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.

3. **Fetch inside Framer overrides**: Allowed origins on the token should list every Framer host that calls this URL.

```
fetch('https://realcomposer.com/v1/workspace/mailchimp-subscribe-framer-contact-form', {
  headers: { Authorization: 'Bearer rc_live_your_token' }
});
```

## Pipeline config

Import this config into a RealComposer pipeline. `{{secrets.NAME}}` values are read from the encrypted Secret Vault at request time, so the client never sees them.

```json
{
  "name": "Mailchimp subscribe api from framer contact form",
  "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
    }
  ],
  "outputMapping": {
    "version": 1,
    "fields": [
      {
        "targetPath": "memberId",
        "sourcePath": "members.0.id",
        "type": "string",
        "sourceStep": "mailchimp"
      },
      {
        "targetPath": "email",
        "sourcePath": "members.0.email_address",
        "type": "string",
        "sourceStep": "mailchimp"
      },
      {
        "targetPath": "status",
        "sourcePath": "members.0.status",
        "type": "string",
        "sourceStep": "mailchimp"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X GET "https://realcomposer.com/v1/workspace/mailchimp-subscribe-framer-contact-form" \
  -H "Authorization: Bearer rc_live_client_token"
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_mailchim",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "mailchimp-subscribe-framer-contact-form"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
```

Slimmed RealComposer response:

```json
{
  "memberId": "sample",
  "email": "sample",
  "status": "sample"
}
```

## FAQ

### Does Framer need CORS changes after adding RealComposer?

Log request IDs for mailchimp-subscribe-framer-contact-form, not raw Mailchimp payloads, because upstream bodies may include PII.

### What cache key does RealComposer use?

mailchimp-subscribe-framer-contact-form forwards client JSON to POST upstreams unchanged; secrets interpolate only in URLs and header templates.

### How do I rotate upstream credentials?

Rotate vault secrets for mailchimp-subscribe-framer-contact-form anytime; clients keep the same rc_live_ token.
