← Integrations

No-code / CMS · JavaScript

Fill numerology fields in Airtable with a Run script action

Coaches and astrologers who keep clients in Airtable usually want the numbers on the record, not in another tab. An automation with a Run a script action can call AstroNode when a client is added and write the results into number fields. Two details decide whether it works: the date format and the date the numbers are computed for.

Updated

How this page was checked: Airtable was not run. The script was executed on Node 24 as an async function with input.config(), base.getTable().updateRecordAsync() and output.set() stubbed and Node's own fetch calling the in-memory API; the record updates and the 400 below are from those runs.

The table and the automation

Fields in a `Clients` table
FieldType
NameSingle line text
Date of birthDate, with time off
Life path, Expression, Soul urge, Personal yearNumber, integer
Numbers as ofDate
  • Trigger: When a record is created - or, to catch records whose date of birth is filled in later, a condition-based trigger on "Date of birth is not empty and Life path is empty".
  • Action: Run a script. In the script's input variables, add recordId (the triggering record's ID), name and dob from the record, and apiKey.
  • The apiKey value is part of the automation's configuration: anyone who can edit automations in the base can read it. If your script editor offers a secret-type input, use that; either way, keep editor access to the base narrow and use a key you can rotate.

The script

js
const { recordId, name, dob, apiKey } = input.config();

// A date field with "Include time" on arrives as an ISO timestamp; the API takes YYYY-MM-DD.
const day = String(dob).slice(0, 10);
// Personal year/month/day depend on the date they are computed for - pin it.
const today = new Date().toISOString().slice(0, 10);

const body = { dob: day, target_date: today };
if (name && name.trim()) body.name = name.trim(); // "" is a 400; omit it instead

const res = await fetch("https://api.astronode.dev/v1/numerology/pythagorean/report", {
  method: "POST",
  headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify(body),
});
const json = await res.json();
if (!res.ok) throw new Error(`${json.error.code}: ${JSON.stringify(json.error.details ?? json.error.message)}`);

const n = Object.fromEntries(json.data.fields.map((f) => [f.number, f.result.value]));
await base.getTable("Clients").updateRecordAsync(recordId, {
  "Life path": n["life-path"],
  "Expression": n["expression"] ?? null,
  "Soul urge": n["soul-urge"] ?? null,
  "Personal year": n["personal-year"],
  "Numbers as of": today,
});
output.set("summary", json.interpretation.summary);

Automation scripts allow top-level await and have fetch built in. Throwing on a non-200 marks the automation run as failed, with the API's error in the run history - better than writing blanks into the record. Number fields need numbers, and result.value is one, so no conversion is needed.

What came back

Asha Rao, born 14 Aug 1990 - written to the record
FieldValuereduction_chain
Life path514 → 5
Expression927 → 9
Soul urge99
Personal year (as of 2026-12-05)514 → 5

With a name the report computed 32 numbers ("Pythagorean report - 32 numbers computed."); a record with no name still worked and got 12, the date-only ones, with Expression and Soul urge left empty. The report endpoint is on the Starter plan. On Free, call POST /v1/numerology/pythagorean once per number instead - { "dob": "1990-08-14", "name": "Asha Rao", "number": "expression" } returned the same 9 - at the cost of one call per field. Pythagorean and Chaldean give different numbers by design: the two systems.

Why the script pins target_date

Life path and expression are fixed by the birth date and name. Personal year, month and day are not: they are computed for a date, and when you leave target_date out the API uses the day of the request. The same client, two dates:

Same name and birth date (real responses)
target_datePersonal yearPersonal monthPersonal day
2026-12-05584
2027-01-10678

So an automation re-run in January silently changes the record. Sending target_date and storing it in Numbers as of makes the fields reproducible and tells the reader when to refresh them - a yearly scheduled automation that re-runs the script for every client is enough for personal year.

The mistakes that bite first

  • A date field with time switched on. It reaches the script as an ISO timestamp, and the API answered dob: "1990-08-14T00:00:00.000Z" with 400: expected YYYY-MM-DD. The script cuts the first ten characters, but turn the field's time off as well: a date-and-time is stored in UTC, so a birth just after midnight in India can come back as the previous day.
  • An empty name. A blank Name field arrives as "", which is a 400 (Too small: expected string to have >=1 characters) - the same run that sent the timestamp reported both fields. Omit name when it is empty, as the script does.
  • Long loops in one run. Automation scripts have a short execution time limit (30 seconds at the time of writing). One call per triggered record is well inside it; re-computing a whole table belongs in a scheduled automation that processes a batch of records per run.

Questions

Which AstroNode endpoints does the Airtable example call?
2 endpoints: Pythagorean Numerology Report (POST /v1/numerology/pythagorean/report); Pythagorean Numerology (POST /v1/numerology/pythagorean).
Was the Airtable code on this page actually run?
Airtable was not run. The script was executed on Node 24 as an async function with input.config(), base.getTable().updateRecordAsync() and output.set() stubbed and Node's own fetch calling the in-memory API; the record updates and the 400 below are from those runs.