Add file.write and YAML information - Slack integration (#12210)

* Add file.write and YAML information

* Fixed data and file order in YAML example.
This commit is contained in:
kuchel77 2020-03-02 19:59:49 +11:00 committed by GitHub
parent b3f7414d1c
commit 02c583d1d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,9 +15,9 @@ The `slack` platform allows you to deliver notifications from Home Assistant to
1. Create a [new app](https://api.slack.com/apps) under your Slack.com account
2. Click the `OAuth & Permissions` link in the sidebar, under the Features heading
2. In the Scopes section, add the `chat:write:user` scope, `Send messages as user`
3. Scroll up to `OAuth Tokens & Redirect URLs` and click `Install App`
4. Copy your `OAuth Access Token` and put that key into your `configuration.yaml` file -- see below
3. In the Scopes section, add the `chat:write:user` scope, `Send messages as user`. If you wish to also be able to include files, you will need to include `files:write:user`. If you get a `missing_scope` error when trying to send a message, check these permissions.
4. Scroll up to `OAuth Tokens & Redirect URLs` and click `Install App`
5. Copy your `OAuth Access Token` and put that key into your `configuration.yaml` file -- see below
<div class='note'>
@ -132,6 +132,19 @@ Example for posting formatted attachment:
}
```
You can also use YAML to send messages from your automations
```yaml
- service: notify.slack
data:
message: "Latest notification"
title: "Latest image"
target: ["#home-assistant"]
data:
file:
path: "/myfile.jpg"
```
Please note that both `message` is a required key, but is always shown, so use an empty (`""`) string for `message` if you don't want the extra text.
To use notifications, please see the [getting started with automation page](/getting-started/automation/).