ahertel / Amazon-Fresh-Whole-Foods-delivery-slot-finder

A Mac tool that finds available delivery slots for Amazon's Whole Foods delivery and Amazon Fresh services
MIT License
1.03k stars 168 forks source link

Send message to iphone via apple messages #7

Closed spinkney closed 4 years ago

spinkney commented 4 years ago

Is it possible to set the script so that it imessages an iphone from the messages app when the slot becomes available?

spinkney commented 4 years ago

Okay, I found how you can do this.

Here it is below

...
else if siteText contains slot_page_keyword and (siteText contains "AM" or siteText contains "PM") then
        -- landed on delivery slot page and delivery slot selection drop down appears aka. slot found!
        tell application "Messages"

            set iMessageid to get id of first service

            set theNumber to buddy "##########" of service id iMessageid --enter the number that you want to send your message to here

            send "Get to amazon.com now, slots are open!" to theNumber

        end tell

        display notification "Found delivery slot!" with title "Amazon" sound name "Sosumi"
        say "Success: Delivery slot found"
        set found_slot to true
...
ahertel commented 4 years ago

this is a great idea for those who can’t be around their computers all the time! I’d love to integrate this into the main script while crediting you. You could submit a pull request or I can just copy/paste myself and credit you with a comment in the script. Let me know what you prefer. Thanks!

bsteinlo commented 4 years ago

Okay, I found how you can do this.

Here it is below

...
else if siteText contains slot_page_keyword and (siteText contains "AM" or siteText contains "PM") then
      -- landed on delivery slot page and delivery slot selection drop down appears aka. slot found!
      tell application "Messages"

          set iMessageid to get id of first service

          set theNumber to buddy "##########" of service id iMessageid --enter the number that you want to send your message to here

          send "Get to amazon.com now, slots are open!" to theNumber

      end tell

      display notification "Found delivery slot!" with title "Amazon" sound name "Sosumi"
      say "Success: Delivery slot found"
      set found_slot to true
...

I duplicated the script and tried adding this but the formatting is all off, I feel like I am missing something silly.

marvinwh2020 commented 4 years ago

Okay, I found how you can do this.

Here it is below

...
else if siteText contains slot_page_keyword and (siteText contains "AM" or siteText contains "PM") then
      -- landed on delivery slot page and delivery slot selection drop down appears aka. slot found!
      tell application "Messages"

          set iMessageid to get id of first service

          set theNumber to buddy "##########" of service id iMessageid --enter the number that you want to send your message to here

          send "Get to amazon.com now, slots are open!" to theNumber

      end tell

      display notification "Found delivery slot!" with title "Amazon" sound name "Sosumi"
      say "Success: Delivery slot found"
      set found_slot to true
...

Can you please tell me where to put this in the original code. I have no experience with this. Thanks marvin

prateekm21 commented 4 years ago

You can put imessage slot here for found https://github.com/ahertel/Amazon-Fresh-Whole-Foods-delivery-slot-finder/blob/master/delivery-window-finder.applescript#L104

and to test you can put where it prints logs "no slots available" - link you will get text for not available; once works you can remove

spinkney commented 4 years ago

@ahertel, feel free to add it in. You can just say thanks to spinkney for providing imesage support in a comment above the code. Thanks!!

ahertel commented 4 years ago

@spinkney thanks for getting back to me. I've added it with a credit to you, and I wrapped it in user interface to ensure data validity and an simpler user experience. If you happen to try it, I'd love to hear your thoughts.

@prateekm21, I replied to your pull request but wanted to thank you again here for your push to get this integrated.

@marvinwh2020 @bsteinlo hope can try the new text message feature. let me know if it works for you.