Skip to content

Instantly share code, notes, and snippets.

@totuworld
Last active April 14, 2016 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save totuworld/9b7c39cc78d70df9cea28a1217c875e6 to your computer and use it in GitHub Desktop.
Save totuworld/9b7c39cc78d70df9cea28a1217c875e6 to your computer and use it in GitHub Desktop.
slackwiki
'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