Skip to content

Instantly share code, notes, and snippets.

@totuworld totuworld/index.js
Last active Apr 14, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.