diff --git a/source/_components/notify.discord.markdown b/source/_components/notify.discord.markdown index a3fb4c7b61d..2a102d073f7 100644 --- a/source/_components/notify.discord.markdown +++ b/source/_components/notify.discord.markdown @@ -9,16 +9,15 @@ sharing: true footer: true logo: discord.png ha_category: Notifications +ha_release: 0.37 --- The [Discord service](https://discordapp.com/) is a platform for the notify component. This allows components to send messages to the user using Discord. -In order to get a token you need to go to the [Discord My Apps page](https://discordapp.com/developers/applications/me) and create a new application. Once the application is ready, create a bot user. Retreive the client ID and the (hidden) token of your bot for later. +In order to get a token you need to go to the [Discord My Apps page](https://discordapp.com/developers/applications/me) and create a new application. Once the application is ready, create a [bot](https://discordapp.com/developers/docs/topics/oauth2#bots) user (**Create a Bot User**) and activate **Require OAuth2 Code Grant**. Retreive the **Client ID** and the (hidden) **Token** of your bot for later. When setting up the application you can use this [icon](https://home-assistant.io/demo/favicon-192x192.png). -### {% linkable_title Configuration %} - To use Discord notifications, add the following to your `configuration.yaml` file: ```yaml @@ -34,16 +33,31 @@ Configuration variables: - **name** (*Optional*): Setting the optional parameter `name` allows multiple notifiers to be created. The default value is `notify`. The notifier will bind to the service `notify.NOTIFIER_NAME`. - **token** (*Required*): Your bot's token. -### {% linkable_title Using the bot %} -Bots can only send messages to servers. To add the bot to a server you are an admin on, use the Discord OAuth2 Authorization page: +### {% linkable_title Setting up the bot %} -[https://discordapp.com/api/oauth2/authorize?client_id=1234567890&scope=bot&permissions=0](https://discordapp.com/api/oauth2/authorize?client_id=1234567890&scope=bot&permissions=0) +Bots can only send messages to servers. To add the bot to a server you are an admin on, get the details of the bot from the [Discord My Apps page](https://discordapp.com/developers/applications/me). -Replace the client ID with the appropriate one from the [Discord My Apps page](https://discordapp.com/developers/applications/me). +

+ +

-Once the bot user has been added to your server, get the channel ID of the channel you want the bot to operate in. -* In The Discord app go to Settings > Appearance > Check developer mode -* Right click channel name > Copy ID +Now use the Discord Authorization page with the **Client ID** of your [bot](https://discordapp.com/developers/docs/topics/oauth2#bots). + +[https://discordapp.com/api/oauth2/authorize?client_id=[CLIENT_ID]&scope=bot&permissions=0](https://discordapp.com/api/oauth2/authorize?client_id=[CLIENT_ID]&scope=bot&permissions=0) + +

+ +

+ +Wait for the confirmation which should say "Authorized". + +Once the bot has been added to your server, get the channel ID of the channel you want the bot to operate in. In The Discord application go to **Settings** > **Appearance** > **Check developer mode**. + +

+ +

+ +Right click channel name and copy the channel ID (**Copy ID**). This channel ID has to be used as the target when calling the notification service. Multiple channel IDs can be specified, across multiple servers. @@ -59,7 +73,7 @@ This channel ID has to be used as the target when calling the notification servi } ``` -### {% linkable_title Notes %} +### {% linkable_title Notes %} For more information about creating and authorizing bots, visit the [OAuth2 information page](https://discordapp.com/developers/docs/topics/oauth2) diff --git a/source/images/screenshots/discord-api.png b/source/images/screenshots/discord-api.png new file mode 100644 index 00000000000..6ba73027993 Binary files /dev/null and b/source/images/screenshots/discord-api.png differ diff --git a/source/images/screenshots/discord-auth.png b/source/images/screenshots/discord-auth.png new file mode 100644 index 00000000000..a34c06dc629 Binary files /dev/null and b/source/images/screenshots/discord-auth.png differ diff --git a/source/images/screenshots/discord-bot.png b/source/images/screenshots/discord-bot.png new file mode 100644 index 00000000000..11da0c9764a Binary files /dev/null and b/source/images/screenshots/discord-bot.png differ