SlackにDMを送信するGAS

const APIToken = 'xoxp-************';
const APIMethodUrl = 'https://slack.com/api/chat.postMessage';
const slackID = 'hoge'
const message = 'こんにちは';
 
const payload = {
    "token": APIToken,
    "channel": slackID,
    "text": message
};
 
const params = {
    "method" : "post",
    "payload" : payload
};
 
UrlFetchApp.fetch(APIMethodUrl, params);
スポンサーリンク