LoginSignup
0
0

More than 3 years have passed since last update.

【備忘】google apps script でslack通知

Posted at

usage

sendSlack("hoge");

関数


function getSlackURL(){
    return "*** slack webhook ***";
}
function sendSlack(text){

    const channel = "#channel_name";
    const data = {
        'channel': channel,
        'username': 'bot',
        'text': text,
        'icon_emoji': ':ghost:'
    };
    const option = { 
        "method": "post",
        "payload": JSON.stringify(data),
        "muteHttpExceptions": true 
    };
    UrlFetchApp.fetch(getSlackURL(), option);
}
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