Skip to main content

Notifications Toolbox

Slackit

Send Slack messages through an incoming webhook. Use it as a library or as the slackit command. A successful post is Slack answering HTTP 200.

Requires Python 3.13 or newer. requests and PyYAML install with the package.

Install

pip install lupaxa-slackit
slackit --help

CLI

slackit --webhook "$SLACK_WEBHOOK_URL" --text "Hello, Slack!"
slackit --webhook "$SLACK_WEBHOOK_URL" --username PyBot --channel "#testing" \
  --icon-emoji ":robot_face:" --text "Hello, Slack!"
slackit --webhook "$SLACK_WEBHOOK_URL" --attachment \
  '{"fallback": "Required summary", "text": "Optional text inside the attachment"}'
slackit --webhook "$SLACK_WEBHOOK_URL" --blocks \
  '[{"type": "section", "text": {"type": "mrkdwn", "text": "Hello from slackit"}}]'
slackit --webhook "$SLACK_WEBHOOK_URL" --validate
slackit --profile testing --text "Hello, Slack!"
slackit -p alerts --config "$HOME/work/slackit.yml" --text "Disk full"
slackit -p testing --channel "#other" --text "Override the profile channel"
python -m lupaxa.slackit --version

The webhook URL must start with https://hooks.slack.com/services/. Put it in the environment or a profile rather than in the command line when you can. --text, --attachment, --blocks, and --validate are mutually exclusive, and one of them is required. --validate posts This is a validation message to channel general. Escaped newlines in --text are sent as real line breaks, so Hello\\nthere arrives as two lines. Flags override the same fields from the selected profile. --timeout must be greater than 0.

Flag Default Description
--webhook, -w profile value Slack incoming webhook URL
--profile, -p — Profile name in the config file
--config ~/.slackit.yml Config file path
--text, -t — Message text
--attachment, -a — Attachment JSON object
--blocks, -b — Block Kit JSON
--validate — Send a validation message to channel general
--username, -u profile value Display name
--channel, -c profile value Channel override
--icon-emoji, -i profile value Icon emoji
--timeout, -T 10 Request timeout in seconds
--version — Print the package version and exit
Code When
0 Help, version, or Slack accepted the post
1 The webhook was rejected, or the post failed
2 Command-line usage, a bad config, or argument parsing failed

Config

Profiles live in $HOME/.slackit.yml. Pass --config to use another file. --config requires --profile. Without --profile, pass --webhook.

profiles:
  testing:
    webhook_url: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXX
    username: PyBot
    channel: "#testing"
    icon_emoji: ":robot_face:"
    timeout: 15
  alerts:
    webhook_url: https://hooks.slack.com/services/T00000000/B00000000/YYYYYYYY
    channel: "#alerts"

Each profile may set webhook_url, username, channel, icon_emoji, and timeout. Unknown keys are rejected. The file must contain a profiles mapping.

Library

from lupaxa.slackit import Slackit, load_profile

profile = load_profile("testing")
client = Slackit(
    profile.webhook_url,
    username=profile.username,
    channel=profile.channel,
    icon_emoji=profile.icon_emoji,
)
client.send_message("Hello, Slack!")
client.send_attachment('{"text": "Inside the attachment"}')
client.send_block('[{"type": "section", "text": {"type": "mrkdwn", "text": "Hello"}}]')

send is an alias of send_message. Username, channel, and icon emoji are added to the JSON body when you set them and the payload does not already include that field. load_profile reads $HOME/.slackit.yml when path is omitted. A missing file, unknown profile, or invalid YAML raises ConfigError.

A Slack HTTP 200 response returns True. Redirects, an empty error body, Slack error text, and invalid JSON raise ValueError. Network failures raise the underlying requests exception. validate returns False when the follow-up HEAD does not succeed.

Development

make init
make python-install-dev
make python-check
The Lupaxa Project Footer

Metadata

Release files for lupaxa-slackit 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lupaxa-slackit 0.1.5
File Size Uploaded
lupaxa_slackit-0.1.5.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lupaxa-slackit 0.1.5
File Interpreter ABI Platform
lupaxa_slackit-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 19.7 kB

Release files / lupaxa_slackit-0.1.5.tar.gz

Download URL lupaxa_slackit-0.1.5.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
11b2328f27a2c80d47d52e505177cc9fc3ccff9dfd577354de6814c23c3be88c
BLAKE2b-256 checksum
How to use checksums
f32ba1c5f29a2e9ba7cbe53bd661141cc8c19ceda5cf5b7fa587555a96d46998
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / lupaxa_slackit-0.1.5-py3-none-any.whl

Download URL lupaxa_slackit-0.1.5-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63c1b0eb307390e18cb46274c0eed1a4b3be2f80bf4192baa925922e669852c7
BLAKE2b-256 checksum
How to use checksums
6bf951bfdb584bf0519bd89232b29967d4180d227bb8c3e2f00190cca6c33341
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.6

2 release files

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page