Hi,
How can I pass my chore_name from the mobile notification to my RESTful Command in n8n?
My configuration:
completed_chore:
url: 'http://192.168.1.1/webhook-test/a3e76213-xxxxxxxxx-xxxxxxxxxxx-xxxxx'
method: put
content_type: 'application/json'
payload: '{"chore_name": "{{ chore_name | string }}", "status": "completed"}'
My notification script that is being called in an automation:
alias: Send Chore Notification to Bella
sequence:
- variables:
chores: "{{ state_attr('sensor.chore_list_sensor', 'Chores') }}"
chore: "{{ chores[chore_index] }}"
- service: notify.pappas_mobil
data:
message: >-
{{ chore.frequency }} Oppgave for Bella: {{ chore.chore }}, verdt {{
chore.poeng }} poeng
data:
actions:
- action: MARK_DONE
title: Utført
data:
chore_name: "{{ chore.chore }}"
- action: SKIP
title: Skip
It’s being passed to the first {{ chore.chore }}
after “Oppgave for Bella:”.
My automation for the action:
alias: Hjemmekampen - Mobilhendelse - Chore utført
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: MARK_DONE
action:
- service: rest_command.completed_chore
data_template:
chore_name: "{{ trigger.event.data.chore_name }}"
What should it be instead of "{{ trigger.event.data.chore_name }}"
?
I get this warning in logs:
Logger: homeassistant.helpers.template
Source: helpers/template.py:2318
First occurred: 16:44:39 (4 occurrences)
Last logged: 16:47:52
Template variable warning: 'dict object' has no attribute 'chore_name' when rendering '{{ trigger.event.data.chore_name }}'
Any help is appreciated.