How to use airtable - 10 common examples

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 alexanian / airtable-last-updated-hack / job.js View on Github external
var airtable = require('airtable');
var async = require('async');
var md5 = require('md5');
var moment = require('moment');
var fs = require('fs');
var configs = require('./configs');
var emailSender = require('./emailSender');
var secrets = require('./secrets');

// Set up connection to Airtable
airtable.configure({
    endpointUrl: 'https://api.airtable.com',
    apiKey: secrets.apiKey
});
var base = airtable.base(secrets.airtableBase);

// Create local storage for hashes of records
var hashDir = './localStorage/';
if (!fs.existsSync(hashDir)) {
    fs.mkdirSync(hashDir);
}

exports.hackLastUpdated = function hackLastUpdated() {
    // Each record that was updated will be included in email notifications
    var recordsUpdated = [];

    // Retrieve records from all tables listed
    async.forEach(configs.airtableTables, function(table, callback) {
        var hashPath = hashDir + table + '.json';
        var hashes = {};
github alexanian / airtable-last-updated-hack / job.js View on Github external
var airtable = require('airtable');
var async = require('async');
var md5 = require('md5');
var moment = require('moment');
var fs = require('fs');
var configs = require('./configs');
var emailSender = require('./emailSender');
var secrets = require('./secrets');

// Set up connection to Airtable
airtable.configure({
    endpointUrl: 'https://api.airtable.com',
    apiKey: secrets.apiKey
});
var base = airtable.base(secrets.airtableBase);

// Create local storage for hashes of records
var hashDir = './localStorage/';
if (!fs.existsSync(hashDir)) {
    fs.mkdirSync(hashDir);
}

exports.hackLastUpdated = function hackLastUpdated() {
    // Each record that was updated will be included in email notifications
    var recordsUpdated = [];

    // Retrieve records from all tables listed
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)
      });
    });
  }
github react-knowledgeable / rk-community-site / src / functions / airtable.js View on Github external
function _configureAirtable() {
  Airtable.configure({ apiKey: '__AIRTABLE_API_KEY__' });
  return Airtable.base('__AIRTABLE_BASE_ID__')('Attendees');
}

airtable

The official Airtable JavaScript library.

MIT
Latest version published 1 year ago

Package Health Score

63 / 100
Full package analysis