Help

Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

Send Twilio SMS's at date/time in Airtable

Topic Labels: Dates & Timezones
395 0
cancel
Showing results for 
Search instead for 
Did you mean: 

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
image

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
            })
        }
0 Replies 0