There are a few instances where the middleware is pulling all contacts from Airtable, just to match a single record. If we can refactor these then we'll be able to reduce the number of API calls to Airtable and improve app load time.
Functions to refactor:
[ ] getCustomerByNumber: called when a new conversation is created by Twilio Conversations on inbound SMS.
[x] getCustomerById: called when a contact is viewed form the contact list.
We may also be able to filter the list of records retrieved from Airtable by filtering by owner.
[x] Filter airtable contacts returned by owner in request.
There are a few instances where the middleware is pulling all contacts from Airtable, just to match a single record. If we can refactor these then we'll be able to reduce the number of API calls to Airtable and improve app load time.
Functions to refactor:
getCustomerByNumber
: called when a new conversation is created by Twilio Conversations on inbound SMS.getCustomerById
: called when a contact is viewed form the contact list.We may also be able to filter the list of records retrieved from Airtable by filtering by owner.