Skip to content

Commit 5dbf148

Browse files
authored
docs(generic): add home assistant example (#336)
1 parent 5656369 commit 5dbf148

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

docs/examples/generic.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Examples
2+
3+
Examples of service URLs that can be used with [the generic service](../../services/generic) together with common service providers.
4+
5+
## Home Assistant
6+
7+
The service URL needs to be:
8+
```
9+
generic://HAIPAddress:HAPort/api/webhook/WebhookIDFromHA?template=json
10+
```
11+
12+
And, if you need http://
13+
```
14+
generic://HAIPAddress:HAPort/api/webhook/WebhookIDFromHA?template=json&disabletls=yes
15+
```
16+
17+
Then, in HA, use `{{ trigger.json.message }}` to get the message sent from the JSON.
18+
19+
_Credit [@JeffCrum1](https://github.com/JeffCrum1), source: [https://github.com/containrrr/shoutrrr/issues/325#issuecomment-1460105065]_

docs/services/generic.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ supports receiving the message via a POST request.
44
Usually, this requires customization on the receiving end to interpret the payload that it receives, and might
55
not be a viable approach.
66

7+
Common examples for use with service providers can be found under [examples](../examples/generic.md).
8+
79
## JSON template
810
By using the built in `JSON` template (`template=json`) you can create a generic JSON payload. The keys used for `title` and `message` can be overriden
911
by supplying the params/query values `titleKey` and `messageKey`.
@@ -26,6 +28,9 @@ would become
2628
generic+https://example.com/api/v1/postStuff
2729
```
2830

31+
!!! note
32+
Any query variables added to the URL will be escaped so that they can be forwarded to the remote server. That means that you cannot use `?template=json` with the `generic+https://`, just use `generic://` instead!
33+
2934
## Forwarded query variables
3035
All query variables that are not listed in the [Query/Param Props](#queryparam_props) section will be
3136
forwarded to the target endpoint.
@@ -41,4 +46,4 @@ If you need to pass a query variable that _is_ reserved, you can prefix it with
4146

4247
## URL Format
4348

44-
--8<-- "docs/services/generic/config.md"
49+
--8<-- "docs/services/generic/config.md"

mkdocs.yml

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ nav:
5454
- Generic Webhook: 'services/generic.md'
5555
- Guides:
5656
- Slack: 'guides/slack/index.md'
57+
- Examples:
58+
- Generic Webhook: 'examples/generic.md'
5759
- Advanced usage:
5860
- Proxy: 'proxy.md'
5961

0 commit comments

Comments
 (0)