Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

slacknotifpy

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slacknotifpy

A Python tool for sending Slack notifications on job completion.

  • 1.0.6
  • PyPI
  • Socket score

Maintainers
1

SlackNotifPy

slacknotifpy is a Python CLI tool that sends notifications to a specified Slack channel on job completion. This can be especially useful for tracking automated job results, such as success or failure, directly in Slack.

Features

  • Runs a Python script or shell command and sends a Slack notification upon completion.
  • Customizable success and failure messages.
  • Simple configuration for Slack tokens and channel IDs.

Installation

Install slacknotifpy from PyPI:

pip install slacknotifpy

Configuration

To use slacknotifpy, you need to configure it with your Slack token and channel ID. These settings will be saved in a .slacknotif_config file.

  1. Run the following command to set up the configuration:
slacknotif init
  1. Follow the prompts to enter:
  • Slack Token
  • Slack Channel ID
  • Custom success and failure messages (optional)

You can find the Slack token and channel ID in your Slack app settings.

Custom Messages

To update the success and failure messages for a project, use:

slacknotif config setmessages

Resetting the Configuration

The initialized config file can be reset using the command:

slacknotif config setconfig

and following the prompts.

Usage

After configuring slacknotifpy, you can use it to run scripts and send notifications:

slacknotif run <script_path> [job_name]
  • script_path: The path to the Python script you want to run.
  • job_name (optional): A name for the job, used in the Slack message. Defaults to the script filename.

Example:

slacknotif run my_script.py "Data Processing Job"

A shell command can be run instead of a Python script by using the --cmd or -c flag:

slacknotif run -c "<SHELL COMMAND>" [job_name]

Example:

slacknotif run -c "ls -l /tmp" [job_name]

Example Slack Notification Messages

  • Success: "Data Processing Job completed successfully"
  • Failure: "Data Processing Job failed"

You can customize these messages using {job_name} as a placeholder in the config.

You can also tag users using thier real or display names using {@John Doe} or {@JohnDoe42}

Command Reference

  • Configure SlackNotifPy: slacknotif init
  • Re-Configure SlackNotifPy: slacknotif config setconfig
  • Set Custom Messages: slacknotif config setmessages
  • Run Script and Notify: slacknotif run <script_path> [job_name]
  • Run Shell Command and Notify: slacknotif run -c "<SHELL COMMAND>" [job_name]

License

This project is licensed under the MIT License.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc