Is it possible to set up an auto-reply to an incoming text or iMessage, either on my iPhone (or the connected Message app on my Mac)?
Ideally I'd like to customize this depending upon the sender.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
Although this solution will NOT allow you to change your response based on sender to the extend your might like it, you can still adjust some settings.
Note: This solution is more of a workaround.
In iOS 11, Apple introduced Do Not Disturb While Driving. In Settings>Do Not Disturb you can specify who you want to auto reply to (No One, Recents, Favorites, or All Contacts) and what you would like to say. If you choose Favorites, you can add favorites my going into the Phone app, Tapping one Favorites, and pressing the Plus button in the upper right corner. Finally, in Settings>Do Not Disturb>Activate, select Manually.
To activate/turn on & off your auto replier open control center by swiping up from the bottom of the screen and tap the Car icon to turn on DND While Driving.
The message you specify will be sent to the contacts your specify.
Apple does not provide this on iOS 11 or earlier since there are automation hooks to send a message, but not to be notified and act upon incoming messages. The Workflow app is the first place I look on iOS to see if there are hooks, but since Apple bought that company - we'll see what happens with iOS automation and iOS 12. I wouldn't expect this is the sort of automation that Apple rolls out first, but I could be wrong on that speculation.
On macOS - you might have more luck with AppleScript and the Script Editor - there is a standard message suite that used to work with IRC / chat for received messaged. I would start on MacOS to script something if you don't mind leaving your Mac logged in, not sleeping and handing off the reply ability.
addressed message received ve : This handler is called for incoming messages that are addressed to you. If the handler returns a text value, it will replace the incoming message.
addressed message received text : The text of the incoming message
buddy: The buddy who sent this message
with text : A text description of the event
The buddy object would let you link this to the send assuming this triggers for iCloud messages in addition to old text messages.
The Messages app dictionary has a send command that accepts text so you should be able to make a simple script to send a stock message to a specific contact. The dictionary also has an event handler suite where received messages can be processed - so you could also test that.
I don't know of anyone writing up code, but the basics look to be there on macOS but not on iOS.