add discord notification node

This commit is contained in:
Waheed-Mousad
2025-06-09 06:17:07 +03:00
parent 79934c4337
commit 449ddc266f
5 changed files with 56 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Waheed Mousad
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+5
View File
@@ -1,9 +1,14 @@
from .notify_whatsapp_twilio import WhatsAppNotifyNodeTwilio
from .notify_discord import DiscordNotifyNode
NODE_CLASS_MAPPINGS = {
"WhatsAppNotifyNodeTwilio": WhatsAppNotifyNodeTwilio,
"DiscordNotifyNode": DiscordNotifyNode,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"WhatsAppNotifyNodeTwilio": "📲 WhatsApp (Twilio)",
"DiscordNotifyNode": "💬 Discord Notify",
}
Binary file not shown.
Binary file not shown.
+30
View File
@@ -0,0 +1,30 @@
import requests
class DiscordNotifyNode:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"img": ("IMAGE",),
"message": ("STRING", {"default": "✅ Workflow complete!"}),
"webhook_url": ("STRING", {"default": "https://discord.com/api/webhooks/..."}),
}
}
RETURN_TYPES = ("IMAGE",)
FUNCTION = "notify"
CATEGORY = "Notifications"
def notify(self, img, message, webhook_url):
try:
payload = {"content": message.strip()}
response = requests.post(webhook_url.strip(), json=payload)
if response.status_code == 204:
print("[💬 DiscordNotifyNode] ✅ Message sent to Discord.")
else:
print(f"❌ DiscordNotifyNode Error: HTTP {response.status_code} - {response.text}")
except Exception as e:
print("❌ DiscordNotifyNode Exception:", e)
return (img,)