Automations

Airtable to Social Media: Publish Records via API

Read records from an Airtable base with Airtable’s REST API and publish each one to your connected social profiles via PostGate.

Quick answer

Create an Airtable personal access token scoped to data.records:read (and write), GET https://api.airtable.com/v0/{baseId}/{table} with filterByFormula to list records marked Ready, POST each record to PostGate's /api/posts with an Idempotency-Key like airtable-{recordId}, then PATCH the record's Posted checkbox. Airtable Automations can run the same logic in a built-in script action, no hosting needed.

Airtable's REST API is a clean fit for exactly this: list records that match a filter, publish each one, then write back that it's done. There's no PostGate listing in Airtable's marketplace, so this guide connects the two directly — a personal access token, one GET call to Airtable, and one POST /api/posts call to PostGate per record.

01

Create a scoped personal access token

At airtable.com/create/tokens, create a token scoped to data.records:read (and data.records:write if you plan to mark rows as posted), and attach only the specific base you're automating. Airtable retired plain API keys in 2024, so this token is the only supported credential now.

02

List records that are ready to publish

The list endpoint is scoped to one base and table, and supports a filterByFormula query parameter so filtering happens on Airtable's side rather than in your script. Results are paginated at 100 records per call; a response over that size includes an offset to pass into the next request.

List recordsPostGate API
curl "https://api.airtable.com/v0/$BASE_ID/Posts?filterByFormula=%7BStatus%7D%3D%27Ready%27" \
  -H "Authorization: Bearer $AIRTABLE_TOKEN"
03

Map a record’s fields to a post

Each record has an id and a fields object keyed by column name. An Attachment-type field returns an array of objects with a url — the same caveat as most cloud tools applies here: Airtable's attachment URLs are short-lived signed links, typically valid for a couple of hours, so pass the URL to PostGate right after fetching the record rather than caching it.

Map and publishPostGate API
async function publishRecord(record) {
  const { Caption, Image, Profiles } = record.fields;
  const imageUrl = Image?.[0]?.url;

  const res = await fetch(
    `https://postgate.studio/api/posts?profile_group_id=grp_acme123`,
    {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.POSTGATE_API_KEY}`,
        'Content-Type': 'application/json',
        'Idempotency-Key': `airtable-${record.id}`,
      },
      body: JSON.stringify({
        post: { body: Caption },
        profiles: Profiles ?? ['pro_instagram123', 'pro_linkedin456'],
        media: imageUrl ? [imageUrl] : undefined,
      }),
    }
  );

  return res.ok;
}
04

Mark the record as posted

Airtable's update endpoint takes a batch of up to 10 records per request, each with an id and the fields to change — flip a Posted checkbox field so the next filterByFormula query excludes it. Combined with the Idempotency-Key on the PostGate call, a script that reruns partway through a batch stays safe either way.

Batch updatePostGate API
curl -X PATCH "https://api.airtable.com/v0/$BASE_ID/Posts" \
  -H "Authorization: Bearer $AIRTABLE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "records": [
      { "id": "rec1234567890abc", "fields": { "Posted": true } }
    ]
  }'
05

Skip the standalone script with Airtable Automations

Airtable's own low-code Automations feature — a built-in part of every base, not a marketplace add-on — can trigger "When record matches conditions" and run a Run a script action with real JavaScript, including fetch. Pasting the mapping and request logic above into that script action removes the need to host and schedule anything yourself. For a fully external, no-code option instead, see calling PostGate from n8n, Make, and Zapier — all three have a native Airtable trigger.

Frequently asked questions

Can I still use an Airtable API key for this?

No — Airtable retired plain API keys in 2024, so a personal access token is the only supported credential now. Create one at airtable.com/create/tokens, scope it to data.records:read (plus data.records:write if you plan to mark rows as posted), and attach only the specific base you are automating.

How do I filter which Airtable records are ready to publish?

Use the filterByFormula query parameter on the list endpoint — for example {Status}='Ready' — so filtering happens on Airtable’s side rather than in your script. The list endpoint is scoped to one base and table, and results are paginated at 100 records per call; a response over that size includes an offset to pass into the next request.

Why do Airtable attachment URLs stop working?

Airtable’s attachment URLs are short-lived signed links, typically valid for a couple of hours. An Attachment-type field returns an array of objects with a url — pass that URL to PostGate right after fetching the record rather than caching it for later, or the link may have expired by the time you publish.

What happens if the sync script reruns partway through a batch?

It stays safe from both sides. The Idempotency-Key on the PostGate call — derived from the record ID, like airtable-{recordId} — means a re-sent create returns the original post instead of a duplicate, and flipping a Posted checkbox via Airtable’s batch update endpoint (up to 10 records per request) means the next filterByFormula query excludes records that already went out.

Do I need to host a server to connect Airtable to social media?

No. Airtable’s own Automations feature — a built-in part of every base, not a marketplace add-on — can trigger "When record matches conditions" and run a script action with real JavaScript, including fetch. Pasting the mapping and request logic into that action removes the need to host and schedule anything. For a fully external no-code option, n8n, Make, and Zapier all have a native Airtable trigger.

Build it with PostGate

One API for every social platform your customers care about — sandboxed, documented, and ready today.

Start building Read the docs