From 02c583d1d3bcaae6a4b8632f95945220621087b6 Mon Sep 17 00:00:00 2001 From: kuchel77 <52343790+kuchel77@users.noreply.github.com> Date: Mon, 2 Mar 2020 19:59:49 +1100 Subject: [PATCH] Add file.write and YAML information - Slack integration (#12210) * Add file.write and YAML information * Fixed data and file order in YAML example. --- source/_integrations/slack.markdown | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/source/_integrations/slack.markdown b/source/_integrations/slack.markdown index e89f5ed0376e..331fcce2ebc3 100644 --- a/source/_integrations/slack.markdown +++ b/source/_integrations/slack.markdown @@ -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
@@ -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/).