Tool Template

Airtable Update Record

by Webble Templates

Use Template
/**
 * @param {object} args
 * @param {string} args.apiToken
 * @param {string} args.tableId
 * @param {string} args.baseId
 * @param {string} args.recordId The id of the record to be updated
 * @param {string} args.fields A key value object of fields to update, e.g {"key": "value"}
 */
async function main(args) {
  const result = await fetch(`https://api.airtable.com/v0/${args.baseId}/${args.tableId}/${args.recordId}`, {
    method: "PATCH",
    body: JSON.stringify({ fields: JSON.parse(args.fields) }),
    headers: { Authorization: `Bearer ${args.apiToken}`, "Content-Type": "application/json" }
  })
    .then(res => res.json())
  return { output: { record: result } }
}

Want to see more chatbot templates and resources?

View more templates