Skip to content

Commit 8d25d7e

Browse files
simaosimaoLandrash
authored andcommitted
Added support for upload of remote or local files to slack, PR home-assistant#8278 … (home-assistant#2949)
* Added support for upload of remote or local files to slack, PR home-assistant#8278 in home-assistant * Update notify.slack.markdown
1 parent 995ccf6 commit 8d25d7e

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

source/_components/notify.slack.markdown

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,47 @@ Configuration variables:
4040
- **username** (*Optional*): Setting username will allow Home Assistant to post to Slack using the username specified. By default not setting this will post to Slack using the user account or botname that you generated the api_key as.
4141
- **icon** (*Optional*): Use one of the Slack emoji's as an Icon for the supplied username. Slack uses the standard emoji sets used [here](http://www.webpagefx.com/tools/emoji-cheat-sheet/).
4242

43+
### {% linkable_title Slack service data %}
44+
45+
The following attributes can be placed `data` for extended functionality.
46+
47+
| Service data attribute | Optional | Description |
48+
| ---------------------- | -------- | ----------- |
49+
| `file` | yes | Groups the attributes for file upload. If present, either `url` or `path` have to be provided.
50+
| `path ` | yes | Local path of file, photo etc to post to slack. Is placed inside `file`.
51+
| `url` | yes | URL of file, photo etc to post to slack. Is placed inside `file`.
52+
| `username` | yes | Username if the url requires authentication. Is placed inside `file`.
53+
| `password` | yes | Password if the url requires authentication. Is placed inside `file`.
54+
| `auth` | yes | If set to `digest` HTTP-Digest-Authentication is used. If missing HTTP-BASIC-Authentication is used. Is placed inside `file`.
55+
56+
Example for posting file from URL
57+
```json
58+
{
59+
"message":"Message that will be added as a comment to the file.",
60+
"title":"Title of the file.",
61+
"data":{
62+
"file":{
63+
"url":"http://[url to file, photo, security camera etc]",
64+
"username":"optional user, if necessary",
65+
"password":"optional password, if necessary",
66+
"auth":"digest"
67+
}
68+
}
69+
}
70+
```
71+
Example for posting file from local path
72+
```json
73+
{
74+
"message":"Message that will be added as a comment to the file.",
75+
"title":"Title of the file.",
76+
"data":{
77+
"file":{
78+
"path":"/path/to/file.ext"
79+
}
80+
}
81+
}
82+
```
83+
Please note that `path` is validated against the `whitelist_external_dirs` in the `configuration.yaml`.
84+
4385
To use notifications, please see the [getting started with automation page](/getting-started/automation/).
4486

0 commit comments

Comments
 (0)