[HN Gopher] Show HN: Schedule iMessage Texts from .txt Files
       ___________________________________________________________________
        
       Show HN: Schedule iMessage Texts from .txt Files
        
       Annoyingly, iPhones don't have a great way to schedule messages.
       This around 100 lines of python to schedule iMessage texts from
       .txt files on your computer.  If this is useful to you, please give
       it a try and let me know what you think. Thanks.
        
       Author : reidjs
       Score  : 77 points
       Date   : 2024-03-09 15:50 UTC (7 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | baxtr wrote:
       | Thanks for sharing. What do you use it for mostly?
        
         | reidjs wrote:
         | I just built it this morning! I was planning to use it to send
         | myself reminders.
        
           | baxtr wrote:
           | Awesome! I wish iMessage had an api so that you didn't need
           | to go through a computer to do these things.
        
             | Solvency wrote:
             | ? Everything goes through a "computer"...
        
           | latexr wrote:
           | Why not use the Reminders app instead?
        
       | alchemist1e9 wrote:
       | This could be insanely useful for me. Thank you! It means I could
       | have a private monitoring approach that send myself a message on
       | events I want notifications on? I didn't even know iMessage
       | allowed sending a self message.
        
         | daed wrote:
         | Telegram bots API works well for this FYI, unless there's a
         | reason you need it in Messages.app
        
       | asciii wrote:
       | Very useful, thanks for sharing!
        
       | nlawalker wrote:
       | The use of "computer" throughout got me excited. Requires a Mac,
       | yes?
        
         | anonymouse008 wrote:
         | Yep, is AppleScript
         | 
         | Still don't know how they get around auto send, iMessage
         | required user input last time I tried this
         | 
         | [Edit] Shortcuts still require user interaction, apparently mac
         | does not, that's interesting
        
           | HnUser12 wrote:
           | On iOS shortcuts you don't need user interaction if you
           | disable "show when run" on the shortcut.
        
         | reidjs wrote:
         | I'll edit the readme for clarity
        
       | Solvency wrote:
       | Out of curiosity couldn't one recreate Twilio just by running an
       | extended version of this from a Macbook?
       | 
       | You could read all inbound messages from the Messages app and
       | reply as well. You could even hook it up to a local LLM and run a
       | small support agent.
       | 
       | Is there ANY reason a small business owner couldn't do this and
       | avoid paying SaaS fees?
        
         | reidjs wrote:
         | It only works for iMessage texts, unfortunately.
        
           | Solvency wrote:
           | But the Messages application can send texts to non-iPhone
           | numbers...
        
             | reidjs wrote:
             | I tried sending to a non iMessage number, it failed to
             | send, but there may be a way.
        
           | FredPret wrote:
           | Might work in areas with huge iMessage market share like
           | North America - I know probably two people with the "green
           | texts"
        
           | dimask wrote:
           | It can also work for SMSs with some changes in the
           | applescript. We made a very similar tool that use to send
           | automated SMSs to experiment participants 2 times per day.
           | The setup is similar and there is a bash script that is
           | called using cron twice per day and calls a matlab script
           | (similar to the python script here) that calls an
           | applescript. This is the applescript that, in practice, sends
           | iMessage to those with iphone and SMS to those without
           | 
           | https://github.com/earlychildcog/automate_sms_to_participant.
           | ..
        
         | anonymouse008 wrote:
         | Unfortunately no, Apple has usage limits on iMessage / SMS
         | relaying. Many people hack around this, SendBlue.co being the
         | only long running service, but it's full of the graveyard of
         | folks trying to do this.
        
           | Solvency wrote:
           | What does this mean in practice? I leave my Messages app on
           | my laptop open all day and correspond entirely through it
           | with family. Since I'm typing I send messages rapidly at
           | volume. I've never once hit a limit. Think hundreds of
           | responses a day.
           | 
           | If an app running on my machine has subclassed the Messages
           | app and is reading strings and sending hit strokes to the
           | (Send) button on my behalf, how can Apple possibly rate limit
           | this?
        
             | mrweasel wrote:
             | It's probably like those email providers that allows you
             | some number of outbound emails per, but it's like 200 -
             | 1000. High enough that most users won't ever notice, but
             | low enough that there's no way to use the service
             | commercially.
        
             | anonymouse008 wrote:
             | It means test on prod and find out
             | 
             | (lose your main iCloud account... 'bold move Cotton')
        
             | password4321 wrote:
             | By number of different recipients?
        
         | marxisttemp wrote:
         | "For a Linux user, you can already build such a system yourself
         | quite trivially by getting an FTP account, mounting it locally
         | with curlftpfs, and then using SVN or CVS on the mounted
         | filesystem. From Windows or Mac, this FTP account could be
         | accessed through built-in software."
         | 
         | People (and corporations) will pay a lot of money to have
         | someone else manage and maintain their infrastructure.
        
       | xyst wrote:
       | If you don't have an Apple computer but have an iOS device, you
       | can also do something similar with the "Shortcuts.app" +
       | "Calendar.app".
       | 
       | I have a daily shortcut that runs at X time. Shortcut checks a
       | calendar for events, if today contains one or more events. It
       | will parse the text from these events (comma separated fully
       | qualified phone numbers or iMessage accounts), and send the
       | message contained in the body of the event.
       | 
       | Added bonus here is that I can also send group messages.
       | 
       | If I need to have the message sent on repeat, then I put the cal
       | event on repeat.
       | 
       | I could possibly even have templated messages (ie, insert month
       | and year into message), but I haven't deep dived into that rabbit
       | hole.
       | 
       | Downside here though is that you need an iOS device to always be
       | on.
        
         | dambi0 wrote:
         | I believe you can run shortcuts on an Apple computer too.
        
       | mrweasel wrote:
       | So not to be that guy, but why the Python code? You could just
       | use launchctl and AppleScript and forego the Python code?
        
         | joshmanders wrote:
         | Probably because they felt more comfortable working in Python
         | than more AppleScript than what was needed.
        
         | ddtaylor wrote:
         | If given the choice between writing AppleScript or Python I'm
         | picking Python. Maybe Python can generate my AppleScript is
         | really as close as I want to be to AppleScript.
        
           | jitl wrote:
           | You can write AppleScript with JavaScript syntax these days,
           | it's not as Python as Python but it's substantially less
           | AppleScript than AppleScript.
        
       | anonymouse008 wrote:
       | Here's an Apple Script moving through iMessage to SMS if
       | required. Make sure to add helpers to update the recipients
       | contact to default to SMS, otherwise you're just cluttering your
       | Messages history with failed messages.
       | 
       | --------
       | 
       | tell application "Messages" set phoneNumber to "+15555555555" set
       | messageToSend to "This is a test!"
       | 
       | try set iMessageService to (1st account whose service type =
       | iMessage) set iMessageBuddy to participant phoneNumber of
       | iMessageService                 if exists iMessageBuddy then
       | set theMessage to send messageToSend to iMessageBuddy
       | delay 2 -- Wait for a short time to allow the message status to
       | update                if status of theMessage is not "delivered"
       | then         error "iMessage not delivered"        else
       | log ("sent as iMessage to: " & phoneNumber)        end if
       | else        error "Not an iMessage user"       end if      on
       | error       try        set SMSService to (1st account whose
       | service type = SMS)        set SMSBuddy to participant
       | phoneNumber of SMSService        send messageToSend to SMSBuddy
       | log ("sent as SMS to: " & phoneNumber)       on error        log
       | ("ERROR: COULD NOT SEND TO: " & phoneNumber)       end try
       | end try
       | 
       | end tell
        
         | reidjs wrote:
         | Awesome!!!! Thank you
        
       | dsalzman wrote:
       | I've built something similar with ios shortcuts. One shortcut
       | that uses prompts and data jar to schedule and store messages. It
       | also creates a cal event as a reminder to myself. It supports
       | group texts. Then I have three automations that run in the
       | morning, noon, and afternoon that check for scheduled messages
       | and send them. Works well. Happy to share if interest.
        
         | anonymous344 wrote:
         | what's the purpose for this?
        
           | jitl wrote:
           | Sometimes I'm up at 4am and want to send a message to someone
           | at a reasonable hour when they're not going to be in Do-not-
           | Disturb mode, seems like a good enough way to accomplish. I
           | use Slack "schedule tomorrow for 9am" pretty frequently for
           | the same use case.
        
           | dsalzman wrote:
           | I use it more as a reminder system. Someone tells me to
           | checkin next week or in a couple days and I can just schedule
           | the text right then so I dont forget.
        
       | latexr wrote:
       | I like reviewing my scheduled messages before sending (maybe the
       | person has said something in the meantime), so the solution I
       | came up with is a shortcut which first asks for text input, then
       | a contact, then the time. All in the best possible interface in
       | context, no need to worry about special syntax or formatting.
       | 
       | The message text is URL encoded, the phone number is auto-
       | retrieved from the contact, then an sms: URL is generated and
       | added to my reminders app. When the time comes, I simply click
       | the link and it auto-populates in Messages, ready to send or
       | tweak.
        
         | reidjs wrote:
         | I like your solution a bit more because it doesn't require
         | scheduling this script to run on a cron or something. How do
         | you URL encode the message? Could you share the whole shortcut
        
           | Zircom wrote:
           | <a href="sms:+15558675309&body=Hi%20there">Send Message</a>
        
       ___________________________________________________________________
       (page generated 2024-03-09 23:01 UTC)