Slack Notification Skill
Send a Slack DM notification when a job/code execution completes.
Prerequisites
The user must provide a Slack webhook URL. To create one:
- •Go to https://api.slack.com/apps → Create New App → From scratch
- •Add "Incoming Webhooks" feature and activate it
- •Click "Add New Webhook to Workspace" and select the DM channel (Slackbot or direct message)
- •Copy the webhook URL
Set the webhook URL via environment variable:
bash
export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/..."
Usage
Run the script after code execution completes:
bash
python3 scripts/send_notification.py \ --job-name "Data Processing" \ --status "success" \ --summary "Processed 1,234 records in 45 seconds"
Parameters
| Parameter | Description | Example |
|---|---|---|
--webhook-url | Slack incoming webhook URL (optional, uses SLACK_WEBHOOK_URL env var) | https://hooks.slack.com/services/... |
--job-name | Brief name of the job | "CSV Export", "Report Generation" |
--status | Completion status | "success", "failure", "completed" |
--summary | Result summary (keep concise) | "Generated 5 charts, exported to PDF" |
Status Formatting
- •
success,completed,done,passed→ green - •
failure,failed,error→ red - •Other values → blue
Workflow
- •Execute the user's code/task
- •After completion, call
send_notification.pywith results - •Confirm notification was sent
Note: Set SLACK_WEBHOOK_URL in ~/.zshrc.local. Override per-call with --webhook-url.