|
| 1 | +--- |
| 2 | +title: Airtable |
| 3 | +--- |
| 4 | + |
| 5 | +import { Callout } from 'nextra/components' |
| 6 | +import { Steps } from 'nextra/components' |
| 7 | + |
| 8 | +# Airtable Integration |
| 9 | + |
| 10 | +Sync data from Airtable tables to your Ycode CMS collections. The integration supports one-way sync (Airtable to Ycode), manual field mapping, and automatic updates via webhooks. |
| 11 | + |
| 12 | +## Setup |
| 13 | + |
| 14 | +<Steps> |
| 15 | + |
| 16 | +### Connect your Airtable account |
| 17 | + |
| 18 | +1. In Ycode, go to **Integrations** > **Apps** |
| 19 | +2. Find **Airtable** and click to open settings |
| 20 | +3. Enter your Airtable [personal access token](https://airtable.com/create/tokens) |
| 21 | +4. Click **Save** to connect |
| 22 | + |
| 23 | +Your token needs the following scopes: `data.records:read`, `schema.bases:read`, and `webhook:manage` (for auto-sync). |
| 24 | + |
| 25 | +### Create a connection |
| 26 | + |
| 27 | +1. In the Airtable settings panel, click **New connection** |
| 28 | +2. Select the **Base** and **Table** you want to sync from |
| 29 | +3. Select the **CMS collection** to sync into |
| 30 | +4. Map Airtable fields to CMS fields using the field mapping grid |
| 31 | + |
| 32 | +### Run a sync |
| 33 | + |
| 34 | +Click **Sync** on the connection to pull all records from Airtable into the CMS collection. You can also trigger a sync directly from the CMS view using the Airtable sync button in the toolbar. |
| 35 | + |
| 36 | +</Steps> |
| 37 | + |
| 38 | +## Field Mapping |
| 39 | + |
| 40 | +Each connection has a field mapping that determines how Airtable fields translate to CMS fields. When creating a connection, Ycode shows all fields from both the Airtable table and the CMS collection side by side. |
| 41 | + |
| 42 | +For each CMS field, select the corresponding Airtable field from the dropdown. Only compatible field types are shown as options. Unmapped fields are skipped during sync. |
| 43 | + |
| 44 | +### Supported Airtable Field Types |
| 45 | + |
| 46 | +| Airtable Type | CMS Type | |
| 47 | +|---------------|----------| |
| 48 | +| Single line text, Formula, AI text | Text | |
| 49 | +| Long text / Multiline | Text | |
| 50 | +| Rich text | Rich text | |
| 51 | +| Number, Percent, Currency, Rating, Auto number, Count | Number | |
| 52 | +| Duration | Number | |
| 53 | +| Date | Date | |
| 54 | +| Date & time, Created time, Modified time | Date | |
| 55 | +| Checkbox | Boolean | |
| 56 | +| Email | Email | |
| 57 | +| Phone number | Phone | |
| 58 | +| URL, Button | Link | |
| 59 | +| Attachments | Image | |
| 60 | +| Single select, Multiple select | Text | |
| 61 | +| Collaborator(s), Lookup, Rollup, Barcode | Text | |
| 62 | + |
| 63 | +Rich text fields from Airtable (Markdown format) are automatically converted to the CMS rich text format. |
| 64 | + |
| 65 | +## Sync Behavior |
| 66 | + |
| 67 | +Each sync compares Airtable records to existing CMS items using a hidden `airtable_id` field that tracks record identity. This means: |
| 68 | + |
| 69 | +- **New records** in Airtable are created as new CMS items |
| 70 | +- **Updated records** have their mapped field values updated in the CMS |
| 71 | +- **Deleted records** in Airtable are not automatically deleted from the CMS |
| 72 | + |
| 73 | +Synced items are created as published and visible on your site immediately. |
| 74 | + |
| 75 | +## Auto-Sync with Webhooks |
| 76 | + |
| 77 | +Enable automatic sync so changes in Airtable propagate to your CMS without manual intervention. |
| 78 | + |
| 79 | +1. Open the connection settings |
| 80 | +2. Click **Enable auto-sync** |
| 81 | +3. Ycode registers a webhook with Airtable that listens for record changes |
| 82 | + |
| 83 | +When a record is created, updated, or deleted in Airtable, the webhook triggers an incremental sync that updates only the affected items. |
| 84 | + |
| 85 | +<Callout type="warning" title="HTTPS required"> |
| 86 | +Auto-sync requires your site to be accessible over HTTPS. The webhook URL must be publicly reachable for Airtable to deliver change notifications. |
| 87 | +</Callout> |
| 88 | + |
| 89 | +### Webhook Renewal |
| 90 | + |
| 91 | +Airtable webhooks expire periodically. Ycode includes a daily cron job that automatically renews webhooks before they expire. For Vercel deployments, this cron is configured in `vercel.json` and runs automatically. For other hosting providers, set up a daily call to `/api/cron/airtable-webhooks`. |
| 92 | + |
| 93 | +To disable auto-sync, click **Disable auto-sync** on the connection. This deregisters the webhook with Airtable. |
| 94 | + |
| 95 | +## Managing Connections |
| 96 | + |
| 97 | +You can create multiple connections to sync different Airtable tables to different CMS collections. Each connection is independent with its own field mapping and sync schedule. |
| 98 | + |
| 99 | +To delete a connection, open its settings menu and select **Delete**. This removes the connection and its webhook but does not delete the synced CMS items. |
| 100 | + |
| 101 | +<Callout type="info" title="Tip"> |
| 102 | +Use the Airtable sync button in the CMS toolbar for quick manual syncs without navigating to the integrations page. |
| 103 | +</Callout> |
0 commit comments