FilterByFormula with a variable

Topic Labels: API
897 0
Showing results for 
Search instead for 
Did you mean: 
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi community.

I’m very new to JS so apologies if this seems basic :pray: .

I’m using Twilio Functions (node.js) to load to AirTable all incoming texts. I’m utilizing 2 tables -

  • “Receive Text” with columns Text date, Text Body and UID.
  • “Users” with columns UID and Phone Number (and a bunch of others).

When a text comes in, I’m trying to use FilterByFormula with the phone number to retrieve the user’s UID from the “Users” table.

Here’s the code I’m running -

var filter = "({Phone Number} = '" + event.From + "')";
    filterByFormula: filter
}).eachPage(function page(records, fetchNextPage) {
    records.forEach(function(record) {
        console.log('Retrieved ', record.get('UID'));
        alert('Retrieved ', record.get('UID'));
}, function done(error) {

let message = {
    "UID" : record.get('UID'),
    "Phone Number" : format_phone,
    "Inbound Text Date" :,
    "Inbound Text Content" : event.Body

base('Receive Text').create(message, function(err, record) {
  if (err) { console.error(err); return; }
  callback(null, message);


Last note - Without the “UID” in the message, the message uploads just fine.

My questions are -

  1. Both the UID and Phone Number are unique values in “Users”, so I’m not sure if I even need the whole piece on handling multiple records. Is there maybe a simpler way of doing it?
  2. I’m not sure I understand how exactly I retrieve the UID once I run the select function. Where exactly is the response stored?

Thanks in advance!

0 Replies 0