Submission destinations

Allow sending responses to destinations like Google Sheets or Airtable. I want to make this as programmable as possible. Here’s the general idea: you use the UI (or command-line) to authenticate a destination, and then use the form API to send a response to that destination.

The second half could look something like this:

let email = await form.short("Hello! What is your email address?", {email: true});
await form.long("Please enter your request");

let response = form.fetch(`${email}`);
let {tier} = JSON.parse(response);

if (tier === 'premium') {
  form.destinations.airtable({base: 'Urgent Requests'});
} else {
  form.destinations.googleSheets({sheet: 'Support Requests'});

I’m going to start with the usual suspects, probably in this order:

  • Google Sheets
  • Telegram
  • Airtable
  • Zapier
  • Webhooks
  • Slack

Delivery guarantees are an important issue here. What happens if an API request to one of these service fails? Effectively there are three options:

  • At least once: retry until you see a success response, might mean duplicated records in the downstream system
  • Exactly once: impossible in practice because a request to one of these services could succeed without us seeing the response (timeouts, networking issues), unless the downstream system has support for something like an idempotency key.
  • At most once: no retries

I’m probably going to go with the first option but with a bounded number of retries, and send the form owner an email if the failures persist.