Getting data from Billwerk using Airtable script

300 0
Showing results for 
Search instead for 
Did you mean: 
7 - App Architect
7 - App Architect


I've created a script with the purpose of letting me know whether or not a customer exists based on an External id (could be: 123456789). When the ID is entered in the ID_field in Airtable the script should run and check in Billwerk if an ID matches. If so, give me a thumbs up in a Status field. 

Here is the Script:




let apiKey = "XXXXXX";
let secret = "XXXXXXX"
let endpoint = "";

// Define the Airtable table
let table = base.getTable("tblovGgaXXXXX");

// Define the function to check if a customer exists in Billwerk
async function checkCustomerExists() {
// Get the input data from Airtable
let airtableData = await table.selectRecordsAsync();
let inputData = => record.getCellValue("External Id"));

// Fetch the customer data from Billwerk
let requestOptions = {
headers: {
Authorization: `Bearer ${apiKey}`,
try {
let response = await fetch(endpoint, requestOptions);
let customerData = await response.json();

// Compare the customer data to the input data
for (let customer of customerData) {
if (inputData.includes(customer.externalId)) {
// Update the status field in Airtable to indicate a match
await table.updateRecordAsync(, {
"Status": "Exists in Billwerk"
} catch (error) {

// Call the function to check if a customer exists in Billwerk


When testing the script in Airtable, I get an 'Test ran successfully', but also a CONSOLE.ERROR: {name: "d"}.
Can someone help me over the finish line here? 


0 Replies 0