{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "airtable-create-record", "type": "registry:item", "description": "Create a record in Airtable", "dependencies": [], "files": [ { "path": "steps/airtable-create-record.ts", "content": "/**\n * Create a record in Airtable\n *\n * @param baseId - The Airtable base ID\n * @param tableId - The table name or ID\n * @param fields - Object containing field names and values\n * @returns The created record with ID\n *\n * @env AIRTABLE_API_KEY - Airtable personal access token\n */\n\nimport { FatalError } from \"workflow\"\n\ninterface CreateRecordOptions {\n baseId: string\n tableId: string\n fields: Record\n}\n\nexport async function airtableCreateRecord({ baseId, tableId, fields }: CreateRecordOptions) {\n \"use step\"\n\n const apiKey = process.env.AIRTABLE_API_KEY\n if (!apiKey) {\n throw new FatalError(\"AIRTABLE_API_KEY environment variable is required\")\n }\n\n if (!baseId || !tableId || !fields) {\n throw new FatalError(\"baseId, tableId, and fields are required\")\n }\n\n const url = `https://api.airtable.com/v0/${baseId}/${encodeURIComponent(tableId)}`\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ fields }),\n })\n\n if (!response.ok) {\n const error = await response.text()\n throw new Error(`Failed to create Airtable record: ${error}`)\n }\n\n const data = await response.json()\n return {\n id: data.id,\n fields: data.fields,\n createdTime: data.createdTime,\n }\n}\n", "type": "registry:file", "target": "steps/airtable-create-record.ts" } ] }