Last active
April 14, 2016 06:55
-
-
Save totuworld/9b7c39cc78d70df9cea28a1217c875e6 to your computer and use it in GitHub Desktop.
slackwiki
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
'use strict'; | |
const querystring = require('querystring'); | |
module.exports = function(context, req) { | |
let parseBody = querystring.parse(req.body); | |
if (parseBody.text) { | |
context.res = { | |
"content-type":"application/json", | |
body:{ | |
response_type:"in_channel", | |
text: `I found some about "${parseBody.text}"`, | |
attachments: [ | |
{ | |
text: `For more info please visit to \nhttps://ko.wikipedia.org/wiki/${parseBody.text}`, | |
color: "#7CD197" | |
} | |
] | |
} | |
}; | |
} | |
else { | |
context.res = { | |
status: 400, | |
body: "Please pass a text on the query string or in the request body" | |
}; | |
} | |
context.done(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment