# Slack APIのURLとトークンを設定
$url = "https://slack.com/api/chat.postMessage"
$token = "YOUR_SLACK_API_TOKEN"
# 送信するメッセージを設定
$message = @{
channel = "#general" # 送信するチャンネル名
text = "Hello from PowerShell!" # 送信するテキストメッセージ
}
# Slack APIにPOSTリクエストを送信
Invoke-WebRequest -Uri $url -Method Post -ContentType "application/json" -Headers @{Authorization = "Bearer $token"} -Body ($message | ConvertTo-Json)
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme