Passing message variable to notify command_line

All,
I’m struggling with passing variables to my custom script and couldn’t find in the forum what I’m doing wrong. The script works fine, but instead of using the variable message, I receive “{{ message }}” as the hard-coded content. Can someone point me in the right direction?

notify:
  - name: imessage
    platform: command_line
    command: >
      bash /config/scripts/imessage.sh {{ message }}

After doing more research on this, I don’t think it’s possible to pass a variable using the command_line notify syntax.

I created a shell_command config instead:

shell_command:
  imessage: >
    bash /config/scripts/imessage.sh {{ target }} "{{ message }}"

And a REST notify config that calls this script:

  - name: imessage
    platform: rest
    resource: 'http://homeassistant:8123/api/services/shell_command/imessage'
    method: POST_JSON
    headers:
      authorization: !secret imessage_rest
      content-type: 'application/json'
    message_param_name: message
    target_param_name: target

Now everything seems to be working fine.

Hi @tomx101,
I was wondering if your restful notify procedure is still working?
I am trying to do the same but keep on getting a login error for authorization failure. My shell_command performs as expected. Has the resource specified in the rest notify config changed? My rest notify config is in a notify.yaml. The authorization has ‘Bearer followed by the token’. I also use NGinx if that would make a difference.
Thanks for any hints to get past this.