Add notification message as parameter in restful notify configuration

Hi, I configured a rest notification in my HA that sends a notification to Alexa using notify me on a certain trigger. The configuration looks like this:

  - name: SmallBathRoomNotification
    platform: rest

The notification is working fine, but as you can see I’m adding the message as part of the endpoint in the configuration.

I want get the message from the automation action itself instead of adding it in the configuration, so the question is how to add message from the automation action as a parameter in the notify resource?

In other words, can I change the configuration to something like:

  - name: SmallBathRoomNotification
    platform: rest

where = replaces with the message given in the automation action?

Thanks for help.

Not sure how this works with Alexa, but normally you set the message parameter in your notification, like so:

- name: notification_persistent
  platform: rest
  resource: 'http://localhost:8123/api/services/persistent_notification/create'
  method: POST_JSON
    authorization: !secret hass_access_token_persistent_notification
    content-type: 'application/json'
  message_param_name: message
  title_param_name: title
  target_param_name: target

Maybe this helps in your case as well. :slight_smile:

EDIT: Forgot, you then call this notification with message as a parameter:

- platform: group
  name: notification_level_1
    - service: notification_persistent
        message: "{{ message }}"
        title: "{{ title }}"
        target: "{{ notification_id }}" 

Does this mean that the post message will have these 3 kyes and their values?

  • message_param_name
  • title_param_name
  • target_param_name

What if I want the post message to have different key names than those?

  • notification
  • accessCode