{
  "slug": "merge-airtable-and-sendgrid-templates",
  "title": "Merge Airtable Records and Sendgrid Email Templates",
  "metaTitle": "Merge Airtable Records and Sendgrid - RealComposer",
  "metaDescription": "Merge airtable records and sendgrid email templates. Merge Airtable and SendGrid in one Frontend / Web call with parallel Worker steps.",
  "headline": "Parallel Airtable fetch merged before Frontend / Web hydrates",
  "category": "aggregation",
  "categoryLabel": "Multi-API Aggregation",
  "urgency": 8,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "Airtable",
    "SendGrid"
  ],
  "searchIntentQuery": "merge airtable records and sendgrid email templates",
  "directAnswerSummary": "Instead of Frontend / Web firing serial fetches to Airtable and SendGrid, one pipeline hits https://api.airtable.com/v0/{{query.baseId}}/{{query.tableName}}?maxRecords=5 (and sibling steps) in parallel and returns mapped JSON.",
  "problem": {
    "title": "Waterfall latency from multiple Airtable and SendGrid requests",
    "explanation": "Frontend / Web widgets often await Airtable and SendGrid sequentially, multiplying TLS handshakes on cellular networks and amplifying failure rates.",
    "risks": [
      "Race conditions between parallel manual fetches",
      "Higher mobile data usage from redundant JSON",
      "Timeouts when any upstream exceeds cellular RTT"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Add vault secrets for this pipeline",
      "description": "Create AIRTABLE_PAT, SENDGRID_API_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.airtable.com/v0/{{query.baseId}}/{{query.tableName}}?maxRecords=5. 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 Frontend / Web",
      "description": "Allowed origins on the token should list every Frontend / Web host that calls this URL.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/merge-airtable-and-sendgrid-templates', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Merge Airtable Records and Sendgrid Email Templates",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "airtable",
        "upstreamUrlTemplate": "https://api.airtable.com/v0/{{query.baseId}}/{{query.tableName}}?maxRecords=5",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.AIRTABLE_PAT}}"
        },
        "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": "airtable.recordId",
          "sourcePath": "records.0.id",
          "type": "string",
          "sourceStep": "airtable"
        },
        {
          "targetPath": "airtable.fields",
          "sourcePath": "records.0.fields",
          "type": "object",
          "sourceStep": "airtable"
        },
        {
          "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-ai",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "merge-airtable-and-sendgrid-templates"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "airtable_recordId": "sample",
    "airtable_fields": "sample",
    "sendgrid_delivered": "sample",
    "sendgrid_opens": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/merge-airtable-and-sendgrid-templates\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Can Frontend / Web call Airtable without holding the production key?",
      "answer": "Store AIRTABLE_PAT, SENDGRID_API_KEY for merge-airtable-and-sendgrid-templates. Frontend / Web never sees decrypted values."
    },
    {
      "question": "Does POST traffic get cached?",
      "answer": "merge-airtable-and-sendgrid-templates 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": "Upstream steps in merge-airtable-and-sendgrid-templates honor timeoutMs and optional fallback JSON without leaking secrets."
    }
  ],
  "relatedRecipeSlugs": [
    "retool-public-app-hide-api-credentials",
    "flatten-nested-json-api-response",
    "call-airtable-from-flutterflow-securely"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/merge-airtable-and-sendgrid-templates",
    "markdown": "https://realcomposer.com/recipes/merge-airtable-and-sendgrid-templates.md",
    "json": "https://realcomposer.com/recipes/merge-airtable-and-sendgrid-templates.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=merge-airtable-and-sendgrid-templates&via=agent"
  }
}