# Salesforce api composition tool for indie hackers

> Wire Salesforce REST from static sites with vault injection and no Express server. For "salesforce api composition tool for indie hackers", 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 Static HTML / Jamstack hit only https://realcomposer.com/v1/workspace/salesforce-api-composition-indie-hackers with an rc_live_ client token.

- Canonical page: https://realcomposer.com/recipes/salesforce-api-composition-indie-hackers
- Client platform: Static HTML / Jamstack
- Upstream services: Salesforce
- Category: Platforms & Frameworks
- JSON version: https://realcomposer.com/recipes/salesforce-api-composition-indie-hackers.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=salesforce-api-composition-indie-hackers&via=agent

## Problem: CORS blocks Salesforce in Static HTML / Jamstack

Low-code Static HTML / Jamstack tools expose connector tokens in shared workspaces, so Salesforce 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. **Store upstream credentials in Secret Vault**: Add SALESFORCE_ACCESS_TOKEN to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream.

2. **Configure upstream steps and output mapping**: Point step salesforce at https://{{secrets.SALESFORCE_INSTANCE}}.my.salesforce.com/services/data/v68.0/sobjects/Contact/{{query.contactId}} with GET. Add output mapping fields that mirror the JSON contract your screen already expects. Leave cache TTL at 0 when each response is user-specific (include userId or record id in query params before enabling cache).

3. **Call from Static HTML / Jamstack**: Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.

```
fetch('https://realcomposer.com/v1/workspace/salesforce-api-composition-indie-hackers', {
  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": "Salesforce api composition tool for indie hackers",
  "method": "GET",
  "cacheTtlSeconds": 0,
  "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"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X GET "https://realcomposer.com/v1/workspace/salesforce-api-composition-indie-hackers" \
  -H "Authorization: Bearer rc_live_client_token"
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_salesfor",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "salesforce-api-composition-indie-hackers"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
```

Slimmed RealComposer response:

```json
{
  "contactId": "sample",
  "email": "sample",
  "name": "sample"
}
```

## FAQ

### Which Salesforce credential belongs in the vault for this pipeline?

Point Static HTML / Jamstack at /recipes/salesforce-api-composition-indie-hackers edge URL. RealComposer answers OPTIONS with Access-Control headers for allowed origins.

### Does POST traffic get cached?

salesforce-api-composition-indie-hackers vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body.

### What happens if an upstream step times out?

Upstream steps in salesforce-api-composition-indie-hackers honor timeoutMs and optional fallback JSON without leaking secrets.
