Created
May 20, 2016 18:56
-
-
Save jnerius/e7ff64b842c3c12065503552888ef523 to your computer and use it in GitHub Desktop.
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
//Define some vars | |
var doc = conversation.document; | |
var table = doc.getTableName(); | |
var sysId = doc.getUniqueValue(); | |
var display = doc.getDisplayValue(); | |
var docLink = "<" + gs.getProperty('glide.servlet.uri') + "/" + doc.getLink() + "|" + display + ">"; | |
//Create the messages for Connect and Slack | |
var connectMessage = "(via " + gs.getUserDisplayName() + ") " + text; | |
var slackMessage = "(via " + gs.getUserDisplayName() + ") " + docLink + ": " + text; | |
//If message sent successfully, then write to Connect | |
var sentMessage = sendSlackMessage(slackMessage); | |
if(sentMessage == '200'){ | |
var c = new global.ConnectActionUtil(table, sysId); | |
c.sendMessage(connectMessage, 'SlackBot'); | |
} | |
//Method for sending message to Slack | |
function sendSlackMessage(message) { | |
var channel = '#general'; | |
var botName = 'ConnectBot'; | |
var scu = new x_cc16_oauth.SlackConnectUtil(); | |
var response = scu.sendMessage(channel, botName, message); | |
var responseBody = response.getBody(); | |
var httpStatus = response.getStatusCode(); | |
return httpStatus; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment