Update Discord Notify docs with URL attribute (#23335)

This commit is contained in:
Ian Byrne 2022-11-15 21:24:34 +00:00 committed by GitHub
parent 830da35342
commit 44cdecbdd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,6 +74,8 @@ The following attributes can be placed inside the `data` key of the service call
| Attribute | Optional | Description |
| ---------------------- | -------- | ----------- |
| `images` | yes | The file(s) to attach to message.
| `urls` | yes | The file(s) to download from a remote URL and attach to message.
| `verify_ssl` | yes | A boolean to determine if SSL certs should be verified when calling the remote URLs in the `url` attribute. Defaults to `True`.
| `embed` | yes | Array of [Discord embeds](https://discordpy.readthedocs.io/en/latest/api.html#embed). *NOTE*: if using `embed`, `message` is still required.
To include messages with embedding, use these attributes underneath the `embed` key:
@ -103,6 +105,22 @@ To include messages with embedding, use these attributes underneath the `embed`
- "/tmp/garage.jpg"
```
### Example service call with attachments sourced from remote URLs
```yaml
- service: notify.discord
data:
message: "A message from Home Assistant"
target: ["1234567890", "0987654321"]
data:
verify_ssl: False
urls:
- "https://example.com/image.jpg"
- "https://example.com/video.mp4"
```
Note that `verify_ssl` defaults to `True`, and that any remote hosts will need to be in your [`allowlist_external_urls`](/docs/configuration/basic/#allowlist_external_urls) list. Discord limits attachment size to 8MB, so anything exceeding this will be skipped and noted in the error log.
### Example embed service call
```yaml