Skip to content

Commit

Permalink
Add file.write and YAML information - Slack integration (home-assista…
Browse files Browse the repository at this point in the history
…nt#12210)

* Add file.write and YAML information

* Fixed data and file order in YAML example.
  • Loading branch information
kuchel77 authored Mar 2, 2020
1 parent b3f7414 commit 02c583d
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions source/_integrations/slack.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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'>

Expand Down Expand Up @@ -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/).

0 comments on commit 02c583d

Please sign in to comment.