Help

Send Twilio SMS's at date/time in Airtable

Topic Labels: Dates & Timezones
605 0
cancel
Showing results for 
Search instead for 
Did you mean: 
lizziepika
4 - Data Explorer
4 - Data Explorer

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