How Axiom.ai Helper was created

The Axiom.ai API can be super powerful when used to trigger your automations, pass data to them, and check the status of the automations. The API has a wide variety of users, such as being used to trigger your automations from third-party services such as Zapier, Make, cURL, Power Automate and much more.
When considering different methods of using the API an idea came up regarding the use of Axiom.ai as 'middleware' - a piece of software that can be used to connect two other services. The initial idea of this was using Axiom.ai to capture form data from a website and pass it onto your automation to do one of the following operations:
- Send an email notification containing the form data.
- Logging the form data in a Google Sheet.
- Performing operations on the data.
- Pass the data onto another service.
Or all of the above - all of these options could be added into a single automation, meaning that with a single function call to the axiom-ai-helper package you could have the data propagate throughout your system.
💡 Note, this package was created by the author, an employee of Axiom.ai, but is not an official product of Axiom.ai. Issues, questions and feature requests should be directed to the author through the repository: npmjs.com (opens new window).
# Installing the package
axiom-ai-helper is available to download on npmjs.com (opens new window). To install, navigate to your project and install the package using the following command:
npm install axiom-ai-helper
You can then import the required functions individually, at time of writing, the trigger and checkStatus functions are available - there are plans to continue development if new API features become available in the future.
# Usage
I wanted to make this package as easy as possible to use, and as such, only included the standard requirements of the Axiom.ai API. You'll need the following to be able to use the package, all can be acquired from Axiom.ai:
- An account
- An API key
You'll also need to have an automation to use with your code - for triggering automations, you'll need to start your automation with a Receive data from another app step. Tip: ensure that you have the 'test data' filled out, it'll help with testing and debugging, I promise!
# Functions
The package is built using JavaScript and is based on simple HTTP requests, this code is open source and is available on Github: axiom-ai-helper (opens new window).
The functions directly relate to the options that are available within the Axiom.ai API.
| Function | Signature | Endpoint |
|---|---|---|
| Trigger | trigger(name, data, key) | /trigger |
| Status | checkStatus(name, key) | /check-status |
I'd recommend storing the API key in an .env file to safeguard it and ensure that it's not uploaded to a public repository.
# Triggering your automations
The trigger function can be used to trigger an automation that you have previously build in Axiom.ai, this accepts 3 parameters:
| Name | Details | Optional |
|---|---|---|
| name | Name of the automation | No |
| key | API key | No |
| data | Data to send to the automation, formatted as an array of arrays | Yes |
This will return an object containing 3 values that have been returned from the API, see below:
{
status: "",
link: "",
message: ""
}
| Key | Details | Values |
|---|---|---|
| status | The status of your automation | "success"/"error" |
| link | A link to the running automation | "{link}"/null |
| message | Any error messages | "{error}"/{"Automation successfully triggered"} |
An example of running this is included below:
import { trigger } from 'axiom-ai-helper';
...
const result = await trigger(name, key, data);
console.log(result.message);
# Checking the status of your automations
The checkStatus function can be used to check the status of an automation that you have previously run in Axiom.ai, this accepts 2 parameters:
| Name | Details | Optional |
|---|---|---|
| name | Name of the automation | No |
| key | API key | No |
This will return an object containing 3 values that have been returned from the API, see below:
{
status: "",
message: "",
data: {"google-sheet-data": [[],[]]}
}
| Key | Details | Values |
|---|---|---|
| status | The status of your automation | "success"/"error" |
| message | Any error messages | "{error}"/{"Automation successfully triggered"} |
| data | Data written to a Google Sheet | {"google-sheet-data: [[],[]]"}/null |
An example of running this is included below:
import { checkStatus } from 'axiom-ai-helper';
...
const result = await checkStatus(name, key);
console.log(result.message);
# Using the data in Axiom.ai
To trigger an automation, you'll need to have an automation created. Once this has been created, set a Receive data from another app step as the first step, this will allow the automation to be able to receive the webhook that we are sending. In this step, ensure that you have the "Test data" filled in with the same format that you expect to receive the data, this will help with testing. For example:
name, email
Once this has been done, you can then access the data that you send to the automation using the webhook-data data token.
# Potential use cases
There are various use cases that you could make use of while using the Axiom.ai API, such as:
# Contact forms
Using the package to send along the data from a webform can allow you to build completely custom contact or feedback forms. You could use the following code to send along the data:
const result = await trigger("Contact form", "KEY", [["Karl Jones", "example@example.com", "Hi, I'm looking to enquire about a recent order."]]);
Jump into the Axiom.ai extension and create a new automation called "Contact form". As the first step, add a Receive data from another app step, with the following test data set, this will help with creating your automation:
name, email, message
You can use this data by accessing the webhook-data data token. You could then:
- Use a Send an email step to email this data to your team.
- Store using the Write data to a Google Sheet step.
- Automatically craft a response using the Generate text with ChatGPT step.
# Automating actions or track errors in your web app
Whether it's a standard web app or a mobile web app, you can use the API to automation actions or track errors within your web app. This can be helpful for various use cases, such as:
- Tracking newsletter sign ups.
- Logging errors into a Google Sheet.
- Logging attributes about users, such as browser, or language.
Other tools do offer these features, however, this may be worth a look before committing to a larger, and often more expensive, option.
# Wrapping up
Implementing the API into your projects is relatively simple, and if you have the skills or time you likely won't need to use this library - this is purely designed to be a time saver to ensure that you are meeting the requirements of the API without having to write the code yourself.
Future plans for this library will ensure that this will be kept updated with the latest developments in the Axiom.ai API.
You can get started with axiom-ai-helper over on npm: https://www.npmjs.com/package/axiom-ai-helper (opens new window)
💡 Reminder, this package was created by the author, an employee of Axiom.ai, but is not an official product of Axiom.ai. Issues, questions and feature requests should be directed to the author through the repository: npmjs.com (opens new window).