Quick Overview
This workflow accepts traveler flight details via webhook or runs every 5 minutes, predicts airport queue wait times with a custom JavaScript model, generates an alert message using OpenAI, emails the traveler via SendGrid, and logs the prediction to Google Sheets.
How it works
- Receives a POST request to a webhook with traveler/flight details or runs on a 5-minute schedule.
- Normalizes the incoming data into a consistent context (flight, airport/terminal, traveler contact details, and live queue inputs).
- Waits briefly to throttle processing, then calculates predicted security, immigration, and boarding wait times plus risk flags and an optimal arrival time.
- Sends the prediction to OpenAI to generate a short, traveler-friendly alert message.
- Formats the final alert payload (alert level, email subject/body) and prepares a row for tracking.
- Sends the alert email through the SendGrid Mail Send API and appends the prediction record to a Google Sheets tab.
Setup
- Configure the webhook URL in the system that submits traveler requests (POST to
/airport-queue-check) or enable the schedule trigger for proactive runs.
- Add OpenAI credentials and select the chat model used to generate the traveler message.
- Add Google Sheets OAuth2 credentials and replace
YOUR_SHEET_ID and the target range (for example, Predictions!A1:append) in the Google Sheets request URL.
- Add your SendGrid API key by replacing
YOUR_SENDGRID_API_KEY in the Authorization header, and update the sender/recipient fields (including ensuring travelerEmail is provided by the trigger payload).