From 8d25d7ec2b6b9ff55a587d9b5840b0f3c2b67192 Mon Sep 17 00:00:00 2001 From: Simao Date: Sat, 8 Jul 2017 13:57:13 +0200 Subject: [PATCH] =?UTF-8?q?Added=20support=20for=20upload=20of=20remote=20?= =?UTF-8?q?or=20local=20files=20to=20slack,=20PR=20#8278=20=E2=80=A6=20(#2?= =?UTF-8?q?949)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added support for upload of remote or local files to slack, PR #8278 in home-assistant * Update notify.slack.markdown --- source/_components/notify.slack.markdown | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/source/_components/notify.slack.markdown b/source/_components/notify.slack.markdown index d319a37438c..88cee6a70e9 100644 --- a/source/_components/notify.slack.markdown +++ b/source/_components/notify.slack.markdown @@ -40,5 +40,47 @@ Configuration variables: - **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. - **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/). +### {% linkable_title Slack service data %} + +The following attributes can be placed `data` for extended functionality. + +| Service data attribute | Optional | Description | +| ---------------------- | -------- | ----------- | +| `file` | yes | Groups the attributes for file upload. If present, either `url` or `path` have to be provided. +| `path ` | yes | Local path of file, photo etc to post to slack. Is placed inside `file`. +| `url` | yes | URL of file, photo etc to post to slack. Is placed inside `file`. +| `username` | yes | Username if the url requires authentication. Is placed inside `file`. +| `password` | yes | Password if the url requires authentication. Is placed inside `file`. +| `auth` | yes | If set to `digest` HTTP-Digest-Authentication is used. If missing HTTP-BASIC-Authentication is used. Is placed inside `file`. + +Example for posting file from URL +```json +{ + "message":"Message that will be added as a comment to the file.", + "title":"Title of the file.", + "data":{ + "file":{ + "url":"http://[url to file, photo, security camera etc]", + "username":"optional user, if necessary", + "password":"optional password, if necessary", + "auth":"digest" + } + } +} +``` +Example for posting file from local path +```json +{ + "message":"Message that will be added as a comment to the file.", + "title":"Title of the file.", + "data":{ + "file":{ + "path":"/path/to/file.ext" + } + } +} +``` +Please note that `path` is validated against the `whitelist_external_dirs` in the `configuration.yaml`. + To use notifications, please see the [getting started with automation page](/getting-started/automation/).