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:

notify:
  - name: SmallBathRoomNotification
    platform: rest
    resource: https://api.notifymyecho.com/v1/NotifyMe?notification='Bathroom%202%20Window%20has%20been%20open%20for%20more%20than%2010%20minutes!'&accessCode=<my_alexa_access_token>

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:

notify:
  - name: SmallBathRoomNotification
    platform: rest
    resource: https://api.notifymyecho.com/v1/NotifyMe?notification=<message>&accessCode=<my_alexa_access_token>

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
  headers:
    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
  services: 
    - service: notification_persistent
      data_template:
        message: "{{ message }}"
        title: "{{ title }}"
        target: "{{ notification_id }}" 
2 Likes

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?
like:

  • notification
  • accessCode