Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send notification once a stage has finished #796

Open
1 task
PythonFZ opened this issue May 9, 2024 · 4 comments
Open
1 task

send notification once a stage has finished #796

PythonFZ opened this issue May 9, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request p3-nice-to-have

Comments

@PythonFZ
Copy link
Member

PythonFZ commented May 9, 2024

It would be handy to get some information once a stage has successfully finished.
This could include

  • email
  • discord
  • slack
  • mattermost
  • ...

The configuration should be handled via a file, e.g. .zntrack/config.yaml with a notification section.

  • find a suitable notification package
@MrJulEnergy
Copy link
Contributor

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

@MrJulEnergy
Copy link
Contributor

#797 Tries to add a method of storing sensitive data

@MrJulEnergy
Copy link
Contributor

MrJulEnergy commented May 9, 2024

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")

@PythonFZ
Copy link
Member Author

PythonFZ commented May 9, 2024

Maybe something like https://github.com/caronc/apprise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p3-nice-to-have
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants