How to use the airtable function in airtable

To help you get started, we’ve selected a few airtable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maxindelicato / makerads / server / records.js View on Github external
import db, { isoDate } from './db';

import Airtable from 'airtable';
import { airtable as airTableConf } from 'getconfig';
import fs from 'fs';

const request = require('request').defaults({ encoding: null });

const base = new Airtable({ apiKey: airTableConf.apiKey }).base(
  airTableConf.base
);

// used on LIVE to sync data with the AirTable
// base, so that users can submit ads easily
async function sync({ reset } = {}) {
  console.log('syncing');
  try {
    const ids = await getRecords({ reset });
    const updateIds = await updateExistingRecords();
    if (!reset) {
      await updateRecords([...ids, ...updateIds]);
    }
  } catch (err) {
    console.error(err);
    throw err;
github postlight / liftoff / src / dev-components / IndexPage.js View on Github external
componentDidMount() {
    const { currentPage } = this.props;

    const that = this;
    // nested arrays for pagination purposes
    const allRows = [[]];
    let currentRow = 1;

    const base = new Airtable({
      apiKey: process.env.AIRTABLE_API_KEY
    }).base(process.env.BASE_ID);

    tableHasPublishedColumn(base, includePublished =>
      base(process.env.TABLE_ID)
        .select({
          view: process.env.VIEW,
          ...(includePublished ? { filterByFormula: "{Published}" } : {})
        })
        .eachPage(
          function page(records, fetchNextPage) {
            records.forEach(row => {
              if (currentRow > 10) {
                currentRow = 1;
                allRows.push([]);
              }
github celo-org / celo-monorepo / packages / web / server / airtable.ts View on Github external
export default function airtableInit(baseID: string) {
  const { serverRuntimeConfig } = getConfig()

  if (!airTableSingleton) {
    airTableSingleton = new AirtableAPI({ apiKey: serverRuntimeConfig.AIRTABLE_API_KEY })
  }
  return airTableSingleton.base(baseID)
}
github dtinth / automatron / src / ExpenseTracking.ts View on Github external
function getExpensesTable(context: AutomatronContext) {
  return new Airtable({ apiKey: context.secrets.AIRTABLE_API_KEY })
    .base(context.secrets.AIRTABLE_EXPENSE_BASE)
    .table('Expense records')
}
async function getExpensesSummaryData(context: AutomatronContext) {
github dtinth / automatron / src / Cron.ts View on Github external
export function getCronTable(context: AutomatronContext) {
  return new Airtable({ apiKey: context.secrets.AIRTABLE_API_KEY })
    .base(context.secrets.AIRTABLE_CRON_BASE)
    .table('Cron jobs')
}
github postlight / liftoff / src / dev-components / RowPage.js View on Github external
componentDidMount() {
    const {
      match: {
        params: { slugOrId }
      }
    } = this.props;

    const base = new Airtable({
      apiKey: process.env.AIRTABLE_API_KEY
    }).base(process.env.BASE_ID);

    const that = this;

    base(process.env.TABLE_ID).find(slugOrId, (err, record) => {
      that.setState({
        row: formatAirtableRowData(record)
      });
    });
  }

airtable

The official Airtable JavaScript library.

MIT
Latest version published 9 months ago

Package Health Score

70 / 100
Full package analysis