How to post data to Baserow using an Axiom.ai automation

Baserow (opens new window) offers an alternative to spreadsheets and allows for data management at scale with cloud or self-hosted options. Combined with Axiom.ai, there are many opportunities to power up your workflows and store your processed data.

# Getting started


For this guide, we will assume that you have an automation set up within Axiom.ai, have a Baserow account and a database already set up.

To send data to Baserow from your automation, you'll need the following information from your database:

  1. Table ID - You'll find this in the URL - navigate to your table, and grab the second last number. For example, https://baserow.io/database/xxxxxx/table/<TABLE_ID>/xxxxxx.
  2. Database Token - A database token will need to be generated, navigate to My Settings → Database tokens → Create token → give it a name and click "create token". Set the permissions depending on what you are looking to do via your automation.

# Automating Baserow using an Axiom.ai automation


There are many functions of Baserow that can be used within your automation to send data to Baserow, or fetch data from Baserow.

# Sending data to Baserow


Create your automation as you normally would - when you're ready to send your data onto Baserow, continue this guide.

If the data that you are looking to send contains multiple rows of data, first add a Loop through data step to your automation, setting the data to the data token that contains the data that you wish to send to Baserow. Inside of the "Loop through data" step, add a Write Javascript step. If you only have a single row of data, you can skip adding the "Loop through data" step.

First, we will establish some variables to hold important information that your script will need, replacing the text within the < > with your data:

const table_id = "<TABLE_ID>";
const baserow_url = `https://api.baserow.io/api/database/rows/table/${table_id}/?user_field_names=true`;
const database_token = "<DATABASE_TOKEN>";

Next, we will want to create a function that handles sending the data to Baserow, and then call this function. This should be contained within the same "Write Javascript" step as the code above.

const sendToBaserow = async () => {
	try {
    	const response = await fetch(baserow_url, {
        	method: 'POST',
          	headers: {
              	"Authorization": `Token ${database_token}`,
              	"Content-Type": "application/x-www-form-urlencoded"
            },
          	body: new URLSearchParams({
            	"Name": "[google-sheet-data?*&0]",
              	"Homepage": "[google-sheet-data?*&1]"
            })
        });
      
      	if (!response.ok) {
         	console.error("Something went wrong with response", response);
          	return;
        }
      
      	const result = await response.json();
      	console.log(result);
    } catch (error) {
    	console.error("Something went wrong", error);
    }
}

sendToBaserow();

Most of the code above will not need to be modified, however, you will need to update the code inside of the body: new URLSearchParams({}) code with the fields and data that you wish to send. The first item in the key-value pair, Name, for example, needs to be the name of a single column. The second item will be the data that you are sending to Baserow - remember, you can use the Insert data option to insert data tokens from throughout your automation.

By default, when you create a row using this method this will trigger webhooks - if you are following the guide on Triggering an Axiom.ai automation using Baserow you may wish to keep this in mind. This can be disabled by adding &send_webhook_events=false to the end of the baserow_url variable in the code.

Please note, Baserow's API has a rate limit of 20 requests per second as of time of writing - to respect this, it's recommended to add additional Wait steps inside your "Loop through data" step.

# Retrieving a single row from Baserow


Create your automation as you normally would - when you're ready to retrieve your data from Baserow, continue this guide.

To get a single row from your Baserow database, you'll need to perform a request to their API. To access a single row, you will need the ID of the row. This can be found in the UI. First, we will establish some variables to hold important information that your script will need, replacing the text within the < > with your data:

const table_id = "<TABLE_ID>";
const row_id = "<TABLE_ROW>";
const database_token = "<DATABASE_TOKEN>";
const baserow_url = `https://api.baserow.io/api/database/rows/table/${table_id}/${row_id}/?user_field_names=true`;

Next, we will want to create a function that handles retrieving the data from Baserow, and then call this function. This should be contained within the same "Write Javascript" step as the code above.

const retrieveRow = async () => {
	try {
      	const response = await fetch(baserow_url, {
          	method: 'GET',
          	headers: {
              	"Authorization": `Token ${database_token}`,
              	"Content-Type": "application/x-www-form-urlencoded"
            }
        });
      
      	if (!response.ok) {
       		console.error("Something went wrong", response); 
      	}
      
      	const result = await response.json();

        // Return the results in a format that your automation is expecting.
      	return [Object.values(result)];
    } catch (error) {
     	console.error("Something went wrong", error); 
    }
}

return retrieveRow();

Your row data will then be contained within the code-data data token within your automation. Note: this data will contain additional data such as the Row ID, it's recommended you review the data using a Display a message step before use.

# Retrieving multiple rows from Baserow


Create your automation as you normally would - when you're ready to retrieve your data from Baserow, continue this guide.

In order to retrieve multiple rows, we'll need to add some code to your automation. First, we will establish some variables to hold important information that your script will need, replacing the text within the < > with your data:

const table_id = "<TABLE_ID>";
const database_token = "<DATABASE_TOKEN>";
const baserow_url = `https://api.baserow.io/api/database/rows/table/${table_id}/?user_field_names=true`;

Next, we will want to create a function that handles retrieving the data from Baserow, and then call this function. This should be contained within the same "Write Javascript" step as the code above.

const retrieveRow = async () => {
	try {
      	const response = await fetch(baserow_url, {
          	method: 'GET',
          	headers: {
              	"Authorization": `Token ${database_token}`,
              	"Content-Type": "application/x-www-form-urlencoded"
            }
        });
      
      	if (!response.ok) {
       		console.error("Something went wrong", response); 
      	}
      
      	const result = await response.json();
        
        // Return the results in a format that your automation is expecting.
      	return result.results.map(row => Object.values(row));
    } catch (error) {
     	console.error("Something went wrong", error); 
    }
}

return retrieveRow();

There are various different parameters that can be provided to Baserow to customise the data that you are retrieving, such as page, size, search and order_by. We recommend reviewing their API documentation for more details: https://baserow.io/api-docs/database/<TABLE_ID>. All rows of data will be contained within the code-data data token within your automation to use in later steps.

# Triggering an Axiom.ai automation using Baserow


Baserow allows for webhooks to be triggered when an event occurs within your database table. This can be useful for notifying third-party applications of changes. Unfortunately, as Axiom.ai requires specific details within the payload of a webhook request it is not currently possible to trigger your automations directly, but it may be possible to do so using a third party tool such as Zapier or Make as a service layer between Axiom.ai and Baserow.

# Testing your workflow


To test adding data to Baserow, click "Run" within the Builder - open up your Baserow dashboard and open the table to view any changes. To test retrieving data from Baserow, add an output for your data, for example, a Write data to a Google Sheet step.

To test triggering an Axiom.ai automation from an event, perform the event that you have set up within your automation - for example, by inserting or updating data within your database.

For further advice on debugging your automations, see How to debug and Common errors.

# Wrapping up


Combining Baserow and Axiom.ai automations allows you to have a data store that is scalable to store your data - from scraping data, to keeping track of a list of contacts, the possibilities are only limited by your own imagination. We are excited to see what you build with this guide - let us know over in our community (opens new window)


Information correct as of 15th January 2025, changes to either platforms may require updates

1 Triggering your automations via webhook requires a paid subscription, see pricing for more details.