ワンクリックで
slack-messaging
Use when you need to send messages to a Slack channel or read recent messages from a channel via the Slack Web API
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when you need to send messages to a Slack channel or read recent messages from a channel via the Slack Web API
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | slack-messaging |
| description | Use when you need to send messages to a Slack channel or read recent messages from a channel via the Slack Web API |
| license | MIT |
| metadata | {"author":"Petr Král (pekral.cz)"} |
Send and read Slack messages programmatically via the Slack Web API. Two deterministic shell scripts backed by a shared helper library:
send.sh — post a message to a channel via chat.postMessageread.sh — fetch recent messages from a channel via conversations.history
and emit them as stable JSONCredentials are read exclusively from the SLACK_BOT_TOKEN environment
variable. The token is never written to a file, never appears in script output
or logs, and is never committed to the repository.
SLACK_BOT_TOKEN. Never from a file, never echoed.curl -k, no --insecure, no verify=false.curl … | sh).2>/dev/null
on calls whose result matters, no empty catch.set -euo pipefail in every script.curl/jq) or missing SLACK_BOT_TOKEN; 3 API failure (HTTP
non-2xx, network error, or Slack ok:false).Přejdi na https://api.slack.com/apps a klikni Create New App → From scratch.
Vyber workspace a pojmenuj appku (např. messaging-bot).
V sekci OAuth & Permissions → Bot Token Scopes přidej scopy:
| Scope | Použití |
|---|---|
chat:write | odesílání zpráv (send.sh) |
channels:history | čtení zpráv z veřejných kanálů (read.sh) |
channels:read | přístup k metadatům veřejných kanálů |
groups:history | čtení zpráv z privátních kanálů (read.sh) |
Klikni Install to Workspace a potvrď oprávnění.
Zkopíruj Bot User OAuth Token (začíná xoxb-…) z OAuth & Permissions.
Nastav token jako env var — NIKDY ho necommituj do repa, NIKDY ho nevkládej
do .env souboru sledovaného Gitem:
# shell profil (mimo repo) — ~/.zshrc nebo ~/.bash_profile
export SLACK_BOT_TOKEN=xoxb-...
# CI secret (GitHub Actions):
# Settings → Secrets → New repository secret → Name: SLACK_BOT_TOKEN
# V workflow: env: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
V každém kanálu, do kterého chceš psát nebo číst, spusť příkaz ve Slacku:
/invite @jmeno-tveho-bota
V Slacku klikni na název kanálu → View channel details → posuň se dolů →
Channel ID (začíná C… nebo G… u privátních). To ID předávej skriptům.
# TEXT jako argument
send.sh C0123456789 "Zpráva z terminálu"
# TEXT ze stdin (přes -)
echo "Zpráva z pipeline" | send.sh C0123456789 -
# Výstup: ts odeslané zprávy na stdout, log na stderr
# 1718870400.123456
# action=sent channel=C0123456789 ts=1718870400.123456
Chybové stavy:
send.sh # exit 1: usage (chybějící argumenty)
send.sh C0123 "" # exit 1: prázdný text
unset SLACK_BOT_TOKEN
send.sh C0123 "text" # exit 2: chybějící token
# Posledních 20 zpráv (výchozí)
read.sh C0123456789
# Posledních 5 zpráv
read.sh C0123456789 5
# Výstup: stabilní JSON pole seřazené od nejstarší zprávy
# [
# { "user": "U0123456789", "text": "ahoj", "ts": "1718870400.123456" },
# { "user": "U0567890123", "text": "díky", "ts": "1718870461.234567" }
# ]
Chybové stavy:
read.sh # exit 1: usage (chybějící channel ID)
read.sh C0123 0 # exit 1: neplatný limit (musí být 1..200)
read.sh C0123 abc # exit 1: neplatný limit (musí být celé číslo)
unset SLACK_BOT_TOKEN
read.sh C0123 # exit 2: chybějící token
[
{ "user": "U0123456789", "text": "zpráva", "ts": "1718870400.123456" },
{ "user": null, "text": "bot msg", "ts": "1718870461.234567" }
]
user je null pro zprávy od botů bez user poletext je "" když Slack pole chybíts je Slack timestamp (řetězec, unikátní ID zprávy)Use when reviewing HTTP API design in a PR or change set — endpoints, routes, HTTP methods, status codes, idempotency, and input validation. Treats the API as a consumer-facing contract and flags resource-orientation, method-semantics, status-code, and trust-boundary violations. Read-only.
Use when checking that the pull request implementation actually fulfills the business requirements stated in the linked issue or task. Returns a plain-language markdown block that is the Functional review half of the two-part CR output (`@rules/code-review/general.mdc` Two-part CR output — Technical & Functional review): a full checklist of every extracted acceptance criterion with its status (Met / Not met / Partial / Divergent) and an explicit Goal met: Yes/No verdict, rendered on every run that has a linked tracker — including the fully affirmative report when every requirement is satisfied. No local file is created and the block is not embedded in the GitHub PR comment.
Use when run code review for a Bugsnag error and publish results to the linked GitHub PR and the Bugsnag error
Use when perform code review for GitHub pull requests and post findings as PR comments plus a non-technical summary to every linked issue
Use when run code review for JIRA issues and publish results to GitHub PR and JIRA
Use when senior PHP code review focused on architecture, business logic, and risk detection. Read-only.