mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 17:27:19 +00:00
Improve webhook trigger documentation (#26689)
This commit is contained in:
parent
5a39fcdf6e
commit
2910260841
@ -788,10 +788,10 @@ automation:
|
||||
webhook_id: "some_hook_id"
|
||||
```
|
||||
|
||||
You can run this automation by sending an HTTP POST request to `http://your-home-assistant:8123/api/webhook/some_hook_id`. Here is an example using the **curl** command line program, with an example data payload:
|
||||
You can run this automation by sending an HTTP POST request to `http://your-home-assistant:8123/api/webhook/some_hook_id`. Here is an example using the **curl** command line program, with an example form data payload:
|
||||
|
||||
```shell
|
||||
curl -X POST -d '{ "key": "value" }' https://your-home-assistant:8123/api/webhook/some_hook_id
|
||||
curl -X POST -d 'key=value&key2=value2' https://your-home-assistant:8123/api/webhook/some_hook_id
|
||||
```
|
||||
|
||||
Webhooks support HTTP POST, PUT, and HEAD requests; POST requests are recommended. HTTP GET requests are not supported.
|
||||
@ -802,12 +802,12 @@ Note that a given webhook can only be used in one automation at a time. That is,
|
||||
|
||||
### Webhook data
|
||||
|
||||
You can send a data payload, either as encoded form data or JSON data. The payload is available in an automation template as either `trigger.json` or `trigger.data`. URL query parameters are available in the template as `trigger.query`.
|
||||
Payloads may either be encoded as form data or JSON. Depending on that, its data will be available in an automation template as either `trigger.data` or `trigger.json`. URL query parameters are also available in the template as `trigger.query`.
|
||||
|
||||
In order to reference `trigger.json`, the `Content-Type` header must be specified with a value of `application/json`, e.g.:
|
||||
Note that to use JSON encoded payloads, the `Content-Type` header must be set to `application/json`, e.g.:
|
||||
|
||||
```bash
|
||||
curl -X POST -H "Content-Type: application/json" https://your-home-assistant:8123/api/webhook/some_hook_id
|
||||
curl -X POST -H "Content-Type: application/json" -d '{ "key": "value" }' https://your-home-assistant:8123/api/webhook/some_hook_id
|
||||
```
|
||||
|
||||
### Webhook security
|
||||
|
Loading…
x
Reference in New Issue
Block a user