LoginSignup
0
0

Slack にメッセージを送る

Last updated at Posted at 2023-07-07

次のページを参考にしました。
SlackのIncoming Webhooksを使い倒す
Sending messages using Incoming Webhooks

Slack の endpoint は作成済とします。

curl で POST

go_curl_aa.sh
URL="https://hooks.slack.com/services/*****"
#
curl -X POST --data-urlencode "payload={\"text\": \"TEST Jul/07/2023\" }" $URL
go_curl_bb.sh
URL="https://hooks.slack.com/services/*****"
#
curl -X POST -H 'Content-type: application/json' --data '{"text":"Hello, World!"}' $URL
go_curl_cc.sh
URL="https://hooks.slack.com/services/*****"
#
curl -X POST -d@in01.json $URL

http で POST

go_http.sh
URL="https://hooks.slack.com/services/*****"
#
http $URL < in01.json
in01.json
{"text":"Hello, World! Jul/07/2023 こんにちは"}

Slack に届いたメッセージ

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0