Dashboard to monitor and receive alerts for changes in Southwest fare prices.
I'm a lazy programmer who was tired of checking flight prices. ¯\_(ツ)_/¯
Since I would rather not get in trouble for publishing this tool to npm, you can
clone the repo locally and use npm link
to use the executable.
cd wherever-you-cloned-it-to
npm link
It will scrape Southwest's prices every n
minutes (n
= whatever interval you
define via the --interval
flag) and compare the results, letting you know the
difference in price since the last interval. The default interval is 30 mins and
the default fare type is dollars.
You may optionally set the --individual-deal-price
flag, which will alert you
if either fare price falls below the threshold you define. There is also the
optional --total-deal-price
flag, which will alert you if the combined total
of both fares falls below the threshold. Most flags are required, unless stated
otherwise.
swa \
--from 'DAL' \
--to 'LGA' \
--leave-date '11/01/2017' \
--return-date '11/08/2017' \
--leave-time 'anytime' \ # Can be anytime, morning, afternoon, evening (optional)
--return-time 'anytime' \ # Can be anytime, morning, afternoon, evening (optional)
--fare-type 'dollars' \ # Can be dollars or points (optional)
--passengers 2 \
--individual-deal-price 50 \ # In dollars or points (optional)
--total-deal-price 120 \ # In dollars or points (optional)
--interval 5 \ # In minutes (optional)
--daily-update \ # Send a daily SMS update of prices (optional)
--daily-update-at '19:00' # Time to send daily update, default is 18:00/6pm (optional)
--nonstop # Filter to only nonstop flights (optional)
If you would like to look at flights going one way between two airports, you can use the --one-way
flag. This ignores values entered with --return-date
and --return-time
, and --total-deal-price
.
swa \
--one-way
--from 'DAL' \
--to 'LGA' \
--leave-date '11/01/2017' \
--leave-time 'anytime' \ # Can be anytime, morning, afternoon, evening (optional)
--fare-type 'dollars' \ # Can be dollars or points (optional)
--passengers 2 \
--individual-deal-price 50 \ # In dollars or points (optional)
--interval 5 # In minutes (optional)
If you have a Twilio account (I'm using a free trial account) and you've set up a deal price threshold, you can set the following environment vars to set up SMS deal alerts. Just be warned: as long as the deal threshold is met, you're going to receive SMS messages at the rate of the interval you defined. Better wake up and book those tickets!
When the Twilio environment variables are configured, you can also use the daily
update flags --daily-update
and --daily-update-at
to send you a daily SMS
message with the current fare prices. The --daily-update-at
flag is in 24
hour time format.
export TWILIO_ACCOUNT_SID=""
export TWILIO_AUTH_TOKEN=""
export TWILIO_PHONE_FROM=""
export TWILIO_PHONE_TO=""
You can create a Telegram bot by speaking with the @botfather account. He will provide you with an API key. Now add your new bot to a group where you wish to see the deal notifications. The next step is to figure out the ID of that chat, which is slightly involved. Create a temporary script with the following contents:
const TelegramBot = require('node-telegram-bot-api');
// replace the value below with the Telegram token you receive from @BotFather
const token = 'YOUR_TELEGRAM_BOT_TOKEN';
// Create a bot that uses 'polling' to fetch new updates
const bot = new TelegramBot(token, {polling: true});
// Matches "/getid"
bot.onText(/\/getid/, (msg) => {
// 'msg' is the received Message from Telegram
const chatId = msg.chat.id;
// send back the ID to the chat
bot.sendMessage(chatId, chatId);
});
Execute that script via node script.js
and then send the /getid
command in the chat.
It should respond with your chat ID, looking like a negative number. You can now
CTRL-C kill and remove the temporary script.
Place both your API token and that chat ID into the following environment variables:
export TELEGRAM_BOT_TOKEN=""
export TELEGRAM_CHAT_ID=""
Same as for Twilio above, when the Telegram environment variables are configured, you
can also use the daily update flags --daily-update
and --daily-update-at
to send
you a daily message message with the current fare prices. The --daily-update-at
flag
is in 24 hour time format.
When building the app, the sub module node-gyp has a dependency on Python 2 at this time.
If you receive a SyntaxError: Unexpected token ...
upon running the swa
command, make sure you are running a version of node that supports ES6
syntax (5.11.0 and up).
You may experience compilation errors when you attempt to run npm link
. If so,
you'll need to make sure you have a C++11 compiler installed on your system.
If you're running on Windows this is sometimes resolved by installing the Visual C++
Build Tools. For *nix
systems you'll need to find the specific package needed for your particular OS.
Under some circumstances, libxmljs may throw an error that looks like this:
Error: Could not locate the bindings file. Tried:
→ /root/swa-dashboard/node_modules/libxmljs/build/xmljs.node
You can fix it by rebuilding libxmljs manually:
sudo npm install -g node-gyp
cd node_modules/libxmljs
node-gyp rebuild