Notifications via imessage

Hi there,

maybe one of you guys can help me :smiley:
so shortly my setup, im running HA as a VM and have a physical iMAC next to it.
i have installed the Terminal Add-on.
created ssh keys and exchanged them with my mac. so far so good :slight_smile:

on my Mac i have a script called which well… sends the message :wink:
cat<<EOF | osascript - “${recipient}” “${message}”
on run {targetBuddyPhone, targetMessage}
tell application “Messages”
set targetService to 1st service whose service type = iMessage
set targetBuddy to buddy targetBuddyPhone of targetService
send targetMessage to targetBuddy
end tell
end run

when i run in terminal:
ssh -o ‘StrictHostKeyChecking=no’ som[email protected] “/Users/your_username/Documents/ [email protected] ‘Test from Home Assistant’”

i get a notification on my phone, so basically works as expected.

so now i wanted to use it in an notification and basically use “Target” and “Message” Values to be a little more flexible.
so on my HA i created the script “”, made it executeble with following content:
ssh -o ‘StrictHostKeyChecking=no’ [email protected] “/Users/your_username/Documents/ $1 ‘$2’”

i then created a shell command:
imessage: >
bash /config/scripts/ {{ target }} “{{ message }}”

i created a long lived access token and stored it in my !secret as
imessage_rest: “Bearer XXXXXXXXXXXXXXXXXXXXX”

and created the notification:

in the automation then i have:

service: notify.imessage
message: argh
target: [email protected]

When running the notification i unfortunately only get this log:

Logger: homeassistant.components.shell_command
Source: /usr/src/homeassistant/homeassistant/components/shell_command/
Integration: Shell Command (documentation, issues)
First occurred: 10:56:31 (3 occurrences)
Last logged: 11:21:52

Error running command: bash /config/scripts/ {{ target }} "{{ message }}", return code: 255

maybe someone with a little deeper knowledge can point me in the wrong direction as i cant seem to figure it out :-/

thanks so much and regards,

sorry for posting this way, but i was only allowed to post 2 links (i guess code is also considered a link?)

figured it out, im stupid… SSH permissions…

I am getting the same error code. how did you fix this if you don’t mind my asking?