mrechs
(Matthew Rechs)
August 26, 2024, 12:00pm
1
Could anybody give me an example of how to access the payload (e.g. query string or POST data) of the webhook used to trigger an automation? I cannot seem to get this to work.
For example I have configured an automation with webhook ID"announce-visitor" and I trigger it with:
http://[HA URL]:8123/api/webhook/anounce-visitor?key=myValue
I try to send a notification using this YAML:
metadata: {}
data:
message: Trigger data: {{ trigger.data.key }}
action: notify.mobile_app_iphone
but I get only “Trigger data:” in the notificaition.
I have the webhook set to GET using the gear icon in the webhook settings. What am I missing?
Sir_Goodenough
((SG) WhatAreWeFixing.Today)
August 26, 2024, 10:23pm
2
Hi ,
I have one home assistant instance webhooking to my home if they want my attention.
Sending:
In a script I do…
- service: shell_command.person_detected
data: {"message":"{{message}}"}
and in the shell I send:
curl -X POST -H 'Content-type:application/json' --data '{"message":"I spy a {{message}} person"}' https://hooks.nabu.casa/gAAAAAblahblahandalotmorecrapherethatwastheoriginalwebhookcode
To Recieve:
- trigger:
- platform: webhook
webhook_id: person-cottage-isejgoeirhgeoigho0ggeoigoeieo0ooeib
allowed_methods:
- POST
- PUT
local_only: false
action:
- alias: "Notify phone(s)"
service: notify.message_dad
data:
message: "{{ trigger.json.message }}"
live_message: " {{ trigger.json.message }}, with my little eye, at the cottage"