Skip to content

Instantly share code, notes, and snippets.

@potato4d
Last active December 20, 2018 01:27
Show Gist options
  • Save potato4d/cb3f181d6ab64a8ca7ad0068e4730b83 to your computer and use it in GitHub Desktop.
Save potato4d/cb3f181d6ab64a8ca7ad0068e4730b83 to your computer and use it in GitHub Desktop.
Botkitを利用してSlack上の発言からGitHubのIssueを作成するBotを作る ref: https://qiita.com/potato4d/items/81e9e8aef6cd57c234af
{
"title": "Issueの題名",
"body" : "IssueのDesciption"
}
const Botkit = require("botkit");
const bot = Botkit.slackbot({
debug: false
});
bot.spawn("直前で取得したアクセストークンを貼り付ける").startRTM();
bot.hears("(Create Issue)",["ambient","mention"], (bot, message) => {
bot.reply(message, message.text.split("\n")[0]);
});
request({
url:"http://user@token:api.github.com/repos/:user/:reponame/issues"
method: "POST",
json: true,
headers: {
"Content-Type":"application/json",
"User-Agent": "UA(必須)"
},
}, (err, res)=>{
if(err){
console.log(err);
return false;
}
return res;
});
$ npm i -S botkit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment