Android has the android.intent.action.RESPOND_VIA_MESSAGE intent, that is made to respond to messages from any app without any user interaction. It was meant to respond with a message to unanswered calls, but it works like this too.
It requires the android.permission.SEND_RESPOND_VIA_MESSAGE...