Installing Your Function in Your Base

Start using your On2Air Functions in your Airtable base

You can install your function using:

Zapier - Use in Zapier
Script - Use in the Scripting App in Airtable
Automation - Use in Automations in Airtable
Node.js - Use in your program or application

_______________________________________

If you haven’t created an API Key to connect On2Air to other apps, create one now

In the Installation tab, choose your Installation Source

Zapier - Use in Zapier
Script - Use in the Scripting App in Airtable
Automation - Use in Automations in Airtable
Node.js - Use in your program or application

Select the corresponding API Key

_______________________________________

Connect your Function to Zapier



To connect to Zapier, you have 2 options

Connect by creating a new Zap
Connect by choosing a pre-made template (COMING SOON for Functions)

Connect by creating a new Zap

Choose Zapier as your Installation Source

Choose your API Key

Begin the process of creating a new Zap in Zapier

Choose On2Air as your app in Zapier

Enter the API Key when prompted

Finish configuring your Zap

Connect by choosing a pre-made template

Choose one of the On2Air pre-made templates for Zapier

COMING SOON!

_______________________________________

Connect your Action using Scripts



Once you create and test your function, On2Air automatically generates a Script for you to add to the Scripting App in Airtable. The Script contains almost everything you need to use your action immediately.

Choose Scripts as your Installation Source and select your API Key (A script is automatically generated)

Optional settings:

Include Function Definition (Default) - This includes the global function to call any On2Air Function. Its only needed once per code
block so if calling multiple functions in same block, can disable after the first.

Using Data from Input Configuration (Default) - If using configuration data to set your values. Disable to set your data within the code

Process Record from Button - If using a button to start the script, will use the record clicked on. Only applicable if Trigger Mode is
Record IDs
Useful for single record function calls - if doing multiple records, you'll need to create your own script to select the records you need

Click Copy to Clipboard to copy the script

Paste the script into the Scripting App in Airtable or into On2Air: Scripts

It will generate an Actions configuration panel

Paste the Function ID into the Function Code field
-The Function ID is the unique identifier in the title of your Function in On2Air

Due to Airtable limitations, you will need to add a single space in the Callback URL field (if not using a callback URL)

If you are using a callback URL, enter the URL

Click Run

The first time you run the function, it will ask you to choose a record

Button Example:

Create a Button field
Choose Run script as the Action
Choose the Dashboard and the Scripting app where you just added the script
Then click the button in your record

You can now click the Button in your record each time instead of having to edit anything in the Scripting app

Optional Settings in Script

func_input['callback'] - Set to a webhook URL to receive the response upon completion

func_input['wait'] = false;
- Set to true if you need to use the results in your remaining script/automation. Use with Caution as functions may take longer than Airtable's execution time limits

func_input['stringify'] = false;
- Set to true if you need the response to be a JSON string instead of an object; Useful for using with Airtable automations on callback

In the generated script, you will see an output of what the data will look like. There are several areas in the script marked as ‘TODO Item(s)’. You will need to review each TODO, add your logic to the script, add values, or other relevant instructions.

When you update the TODOs, it’s automatically added in the Output to be available for future steps if needed

Review and complete each TODO Item

//TODO (1/2) configure the inputs for the function
// Pass in an array or record ids to be processed

func_input['record_ids'] = [record.id]

- Enter your Record IDs. ex: ["rec1","rec2"]

This is only used if your function is using Record IDs as the Trigger Mode

_______________________________________

Connect your Action to Airtable Automations



You can use Functions directly inside of Automations in your base. Using On2Air: Actions in parallel with Automations is essential to perform a variety of functions not available within Airtable.

Choose Automation as the Installation Source and then choose your API Key
A script is automatically generated

Optional settings:

Include Function Definition (Default) - This includes the global function to call any On2Air Function. Its only needed once per code block so if calling multiple functions in same block, can disable after the first.

Using Data from Input Configuration (Default) - If using configuration data to set your values. Disable to set your data within the code

Click Copy to Clipboard to copy the script

Open your base in Airtable (the one configured in your Function) and open the Automations tab

Create a Trigger in Airtable Automations
- In our example, we are using At scheduled time > At regular intervals > Every 15 minutes

Next, add an Action (Airtable version)

Click Run script
**Run script **is only available in the Airtable Pro plan

Paste the code into the text editor

Next, click Add input variables

For the name, type code

For the Value, input the Function ID
The Function ID is the unique identifier in the title of your function

If your Trigger Mode is RECORD IDs, you'll need to add an input variable of recordids and then the record IDs as the values._

Click Test

If you want to see the results of what was processed, change func_input['wait'] = false; to func_input['wait'] = true;

Optional Settings in Script

func_input['callback'] = config.callback ? config.callback.trim() : "";
- Set to a webhook URL to receive the response upon completion

func_input['wait'] = false;
- Set to true if you need to use the results in your remaining script/automation. Use with Caution as functions may take longer than Airtable's execution time limits

func_input['stringify'] = false;
- Set to true if you need the response to be a JSON string instead of an object; Useful for using with Airtable automations on callback

In the generated script, you will see an output of what the data will look like. There are several areas in the script marked as ‘TODO Item(s)’. You will need to review each TODO, add your logic to the script, add values, or other relevant instructions.

When you update the TODOs, it’s automatically added in the Output to be available for future steps if needed

Review and complete each TODO Item

//TODO (1/2) configure the inputs for the function
// Pass in an array or record ids to be processed

func_input['record_ids'] = [record.id]

- Enter your Record IDs. ex: ["rec1","rec2"]

This is only used if your function is using Record IDs as the Trigger Mode

_______________________________________

Connect your Action using Node.js

You can use Actions in your program or application

In Installation Source, select Node.js

Select your API Key

Click Copy to Clipboard

Paste into your program

Optional Settings in Node.js

Include Function Definition - If enabled, this includes the global function to call any On2Air Function. Its only needed once per code block so if calling multiple functions in same block, can disable after the first.
Was this article helpful?
Cancel
Thank you!