Created
December 5, 2019 14:02
-
-
Save bz0/11030c893ac0e9b9546d6f94c91563fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config = { | |
'team': 'xxx', //チームID | |
'token': 'xoxb-xxx', //トークン | |
'headers':{ | |
'authorization': 'Bearer ' + this.token, | |
'Content-Type': 'application/x-www-form-urlencoded', | |
} | |
}; | |
method = { | |
//ワークスペースのユーザ一覧を取得 | |
workSpaceUserList: function(){ | |
var url = 'https://slack.com/api/users.list'; | |
var options = { | |
"method" : "post", | |
"payload" : '', | |
"headers" : config.headers, | |
}; | |
var res = this.apiRequest(url, options); | |
Logger.log(res); | |
return res; | |
}, | |
//招待メール送信 | |
invite: function(){ | |
var url = 'https://slack.com/api/admin.users.invite'; | |
var data = { | |
'email': "xxx", | |
'channel_ids': "xxx", | |
'team_id': "xxx", | |
'token': config.token, | |
'set_active': true | |
} | |
var options = { | |
"method" : "post", | |
"payload" : data, | |
"headers" : config.headers, | |
}; | |
var res = this.apiRequest(url,options); | |
Logger.log(res); | |
}, | |
//招待するユーザのフィルタ(botを除外する) | |
inviteUserFilter: function(){ | |
}, | |
apiRequest: function(url, options){ | |
return UrlFetchApp.fetch(url, options); | |
} | |
} | |
function myFunction() { | |
method.invite(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment