The Discord integration is currently only used for sending notifications from HASS to Discord and requires the creation and configuration of a Discord bot to achieve this functionality. This bot configuration requirement is actually a lot of additional overhead for what could theoretically just be a simple WebHook.
These links are easily created in Discord on a per channel basis and support posting messages natively without the need to create a separate “user” to post in the channel.
I think it would be good if the Discord integration supported both formats. Upon initial creation, it could prompt the user for a type (Bot or WebHook) and then ask for the additional parameters based on the selection.
I also think it would be beneficial to have the option to create multiple Discord entries based on the specific WebHoop API or Bot Channel ID so as to be able to have specific notification entities that can be called as opposed to relying on that data to be passed as a data set item.
I just came here googling for this - as I have setup simple text channels to get all my systems giving me updated straight to my discord app on the phone - but alas, not HA. I dont want to do all that bot stuff - I already have a channel for my systems, and just want to publish a webhook that I can paste into a HA notification with the others (email, iphone) from the various HA automations.
I did the same google searches this morning trying to do the same thing. Not seeing any solutions posted, I created the following rest_command in my configuration.yaml file:
rest_command:
discord_notify:
url: <URL from your Discord webhook server integration>
method: POST
content_type: 'application/json; charset=utf-8'
verify_ssl: true
headers:
accept: "application/json, text/html"
user-agent: "HomeAssistant2DiscordWebhook_v1"
payload: '{"content": "{{ notification }}"}'
You can then use the action in your automation with code similar to the following:
action: rest_command.discord_notify
data: '{ "notification": "this is a very simple notification"}'
I hope this is useful for the next person trying to do a simple webhook alert with discord.