jdholtz / auto-southwest-check-in

A Python script that automatically checks in to your Southwest flight 24 hours beforehand.
GNU General Public License v3.0
460 stars 89 forks source link

Notification Level for Check In only #280

Open spacezorro opened 4 months ago

spacezorro commented 4 months ago

Description

I want to send all notifications to Email but have successful/failed checkins only go to SMS

Where 1 is everything, 2 is successful checkins/errors, and 3 is errors only I want to do { "notification_level": 1, "notification_urls": "mailtos://ALLthestuffgoeshere", "accounts": [ { "username": "1234567", "password": "hunter2", "notification_level": 2, "notification_urls": "sns://gobbledegook/us-west-1/+15555551212" }, { "username": "7654321", "password": "hunter2", "notification_level": 2, "notification_urls": "sns://gobbledegook/us-west-1/+15555552222" }

etc...

That way it keeps the SMS to a minimum instead of SMS bombing someone when the server/docker restarts

What alternatives have you considered?

No response

jdholtz commented 4 months ago

Yes, this is a good feature to add. I’ll add it in the same release as the notifications I explained in #249 which will be by next release.

davidkassa commented 4 months ago

If you're considering updating notifications, can you make the notification_level and url paired? For example: { "username": "7654321", "password": "hunter2", "notifications": [ { "notification_level": 1, "notification_urls": "sns://gobbledegook/us-west-1/+15555551111"}, // admin number / notification { "notification_level": 4, "notification_urls": "sns://gobbledegook/us-west-1/+15555554444"} // family number / notification ] }

jdholtz commented 4 months ago

If you're considering updating notifications, can you make the notification_level and url paired?

I partly misunderstood the original feature request. I believe this is also what @spacezorro is requesting (there are 2 feature requests). I've reverted the changes done in #281 relating to this feature so this could be discussed further.

With the configuration provided by spacezorro, the account notification level would actually override the global level, meaning even the email notifications would be sent only error messages.

Here's what I'm thinking for how this will be specified for the config file. I don't want it to be too complicated either, so let me know what you guys think.

{
    "notifications": [{"url": "smtp://email"}],
    "accounts": [
        {"username": "...", "password": "...", "notifications": [
            {"url": "sms://text", "level": 2}, 
            {"url": "discord://channel"}
        ]},
        {"username": "...", "password": "..."}
    ]
}

For account 1, there would be notifications sent to three places (the levels will be based off of v7.5, not #281):

For account 2:

Any level not specified will default to the current default notification level. If the same URL exists in both the account-specific and global notifications, the account-specific level will override the global level.

spacezorro commented 4 months ago

That's perfect. I run the script for family and my wife/kids only want checkin messages. They don't care about the scheduling or fare checking... But I do so your most recent example is exactly what I was going for.

Does there need to be more levels for "checkin success/fail only"?

jdholtz commented 4 months ago

Does there need to be more levels for "checkin success/fail only"?

Yes, I’ll add that as well. I’ll make a separate PR to add both this and the new config format.