👻
Slackにメッセージを送信する (バッチファイル)
@echo off
chcp 65001 > nul
setlocal
rem https://shaxware.slack.com/services/999999999999999#service_setup
rem curl -X POST --data-urlencode "payload={\"channel\": \"#test\", \"username\": \"webhookbot\", \"text\": \"Tora! Tora! Tora!\", \"icon_emoji\": \":ghost:\"}" https://hooks.slack.com/services/XXXXXXXXX/YYYYYYYYYYYYYYYYYY
set SLACK_WEBHOOK_URI=https://hooks.slack.com/services/XXXXXXXXX/YYYYYYYYYYYYYYYYYY
set SLACK_WEBHOOK_CHANNEL=#test
set SLACK_WEBHOOK_USERNAME=webhookbot
set SLACK_WEBHOOK_TEXT=Tora! Tora! Tora!
set SLACK_WEBHOOK_ICONEMOJI=:ghost:
set SLACK_WEBHOOK_PAYLOAD="payload={\"channel\": \"%SLACK_WEBHOOK_CHANNEL%\", \"username\": \"%SLACK_WEBHOOK_USERNAME%\", \"text\": \"%SLACK_WEBHOOK_TEXT%\", \"icon_emoji\": \"%SLACK_WEBHOOK_ICONEMOJI%\"}"
rem echo %SLACK_WEBHOOK_PAYLOAD%
curl -X POST --data-urlencode %SLACK_WEBHOOK_PAYLOAD% %SLACK_WEBHOOK_URI%
endlocal
exit /b 0
Discussion