I have an Airtable database of questions and dates/times, and am running an automation that runs an Airtable script hitting a Twilio Studio Flow to send a message every hour (message is currently hardcoded.)
I’d like to to just send a message from the Airtable at the date/time in the corresponding Airtable row.
This is the Airtable
I query the table with
let queryResult = await QuestionsTable.selectRecordsAsync();
let record = queryResult.records[0];
console.log(record.getCellValueAsString("Priority"));
// Query for all participants.
const participants = (await ParticipantsTable.selectRecordsAsync({
sorts: [
{field: "Phone Number"}
]
})).records;
output.set('participants', JSON.stringify(participants));
for(const aParticipant of participants) {
// Create Answer Entry
const answerId = await AnswersTable.createRecordAsync({
'Participant Id': aParticipant.name,
'Question Id': 0
});
// Create Studio Flow Execution
const payload = {
To: aParticipant.name,
From: {WhatsApp #},
Parameters: JSON.stringify({
question,
airtableRecordId: answerId
})
}