0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

<Slack>Slackに通知する関数を書いて、いつでも引用できるようにする(GAS)

Last updated at Posted at 2020-07-26

slackでいつでも通知できる関数を作ってしまえば楽なのでは?と思い作成しました。

slack.gs

function notifySlack(payload) {
  var payload = {
    text: message,
    icon_emoji: ":XXXX:",
    username: "byGAS",
  }
  var options = {
    method: "post",
    contentType: "applidation/json;",
    payload: JSON.stringify(payload),
  }

  UrlFetchApp.fetch("YOUR_WEBHOOK_URL", options);
}

このgsを作っておいて、
次に「Slackに通知したい」となった時に呼び出せるようにしておきます。
呼び出し方は以下。

main.gs

function main() {
  // 今回の処理
  notifySlack("ここに今回のメッセージをかく")
}
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?