-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.js
More file actions
23 lines (19 loc) · 668 Bytes
/
util.js
File metadata and controls
23 lines (19 loc) · 668 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var webClient = require('slack-terminalize').getWebClient();
/**
* Wrapper function for postMessage from slack-client to handle formatting.
*
* @param { object } slack-client Channel boject
* @param { string } message to send to Slack channel
* @param { boolean } flag to indicate block formatting
* @return { none }
*
*/
var postMessage = function (channel, response, format) {
format = format || true;
response = (format && '```' + response + '```') || response;
// more on this API here: https://api.slack.com/methods/chat.postMessage
webClient.chat.postMessage(channel, response, {
as_user: true
});
};
exports.postMessage = postMessage;