Open PythonFZ opened 2 months ago
Sending an EMail seems to be a dead an since we either need to use an existing EMail account (for example gmail) and then store a password and username somewhere, or alternativly host our own smtp server, which isnt as simple as it sounds
I wrote the following Node which can send an Notification to a Discord server when given an webhook_url. Note that zntrack.local_config()
isnt currently implemented in ZnTrack
class NotifyMe(zntrack.Node):
webhook_url = zntrack.local_config()
previus_node = zntrack.deps()
def run(self):
try:
node_name = self.previus_node.name
time = datetime.now().strftime("%H:%M:%S")
day = datetime.now().strftime("%B %d. %Y")
msg = {"content": f"Your Workflow has reached {node_name} at {time} on {day}!"}
except AttributeError:
msg = {"content": f"Your Workflow has reached this Node at at {time} on {day}!"}
response = requests.post(self.webhook_url, json=msg)
if response.status_code == 204:
pass
else:
raise Exception("Could not send Message")
Maybe something like https://github.com/caronc/apprise
It would be handy to get some information once a stage has successfully finished. This could include
The configuration should be handled via a file, e.g.
.zntrack/config.yaml
with anotification
section.