public class SlackFunctions extends BaseFunctions
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
APPROVE_STRING |
protected java.lang.String |
REJECT_STRING |
mExecute, mFLOG, mScriptRef
Constructor and Description |
---|
SlackFunctions(boolean isExecute,
LogFunctions pFLOG) |
Modifier and Type | Method and Description |
---|---|
void |
cleanup() |
java.lang.String |
getGroovyKey() |
FDUser |
getUserFromSlackId(java.lang.String pSlackId)
Returns the FlexDeploy User corresponding to the given Slack user id.
|
void |
postAttachment(java.lang.String pSlackAccountCode,
java.lang.String pChannel,
java.io.File pInput,
java.lang.String pMessage,
java.lang.String pParentMessage)
Uploads an attachment to the given Slack channel.
|
void |
postAttachment(java.lang.String pSlackAccountCode,
java.lang.String pChannel,
java.io.InputStream pInput,
java.lang.String pMessage,
java.lang.String pParentMessage)
Uploads an attachment to the given Slack channel.
|
java.lang.String |
postMessage(java.lang.String pSlackAccountCode,
java.lang.String pChannel,
FlexSlackMessage pMessage)
Posts a Slack message using JSON formatted based on Slack API.
|
java.lang.String |
postMessage(java.lang.String pSlackAccountCode,
java.lang.String pChannel,
java.lang.String pJson)
Posts a Slack message using JSON formatted based on Slack API.
|
java.lang.String |
postSimpleMessage(java.lang.String pSlackAccountCode,
java.lang.String pChannel,
java.lang.String pMessageText)
Posts a simple Slack message to the specified channel.
|
captureSecureValuesForLogFunction, decryptIntegrationInstance, doSimpleGet, findIntegrationInstanceByCode, getLogFunctions, getServerBaseUrl, setScriptRef
protected final java.lang.String APPROVE_STRING
protected final java.lang.String REJECT_STRING
public SlackFunctions(boolean isExecute, LogFunctions pFLOG)
public FDUser getUserFromSlackId(java.lang.String pSlackId) throws FlexCheckedException, FlexNotFoundException
pSlackId
- The Slack user id. This can be found in the Slack payload from incoming webhook
messages.FlexNotFoundException
- If no FlexDeploy user was found for the given Slack id.FlexCheckedException
- All other exceptionspublic void postAttachment(java.lang.String pSlackAccountCode, java.lang.String pChannel, java.io.InputStream pInput, java.lang.String pMessage, java.lang.String pParentMessage) throws FlexCheckedException, FlexNotFoundException
pSlackAccountCode
- Messaging account code for Slack account.pChannel
- Name or Id of channel where the attachment will be uploaded. Use user
channel Id to send direct messages.pInput
- The input stream to upload.pMessage
- Text to display giving context about the attachmentpParentMessage
- Parent message/ts id if you wish to post attachment as a reply, leave
as null otherwiseFlexNotFoundException
- If no account is found for give codeFlexCheckedException
public void postAttachment(java.lang.String pSlackAccountCode, java.lang.String pChannel, java.io.File pInput, java.lang.String pMessage, java.lang.String pParentMessage) throws FlexCheckedException, FlexNotFoundException
pSlackAccountCode
- Messaging account code for Slack account.pChannel
- Name or Id of channel where the attachment will be uploaded. Use user
channel Id to send direct messages.pInput
- The file to upload.pMessage
- Text to display giving context about the attachmentpParentMessage
- Parent message/ts id if you wish to post attachment as a reply, leave
as null otherwiseFlexNotFoundException
- If no account is found for give codeFlexCheckedException
public java.lang.String postMessage(java.lang.String pSlackAccountCode, java.lang.String pChannel, FlexSlackMessage pMessage) throws FlexCheckedException
pSlackAccountCode
- Messaging account code for Slack account.pChannel
- Name or Id of channel where the notification will be sent. Use user
channel Id to send direct messages.pMessage
- FlexSlackMessage to post. Formatted based on Slack API.FlexCheckedException
public java.lang.String postMessage(java.lang.String pSlackAccountCode, java.lang.String pChannel, java.lang.String pJson) throws FlexCheckedException
pSlackAccountCode
- Messaging account code for Slack account.pChannel
- Name or Id of channel where the notification will be sent. Use user
channel Id to send direct messages.pJson
- Json string of your Slack message body. Formatted based on Slack API.FlexCheckedException
public java.lang.String postSimpleMessage(java.lang.String pSlackAccountCode, java.lang.String pChannel, java.lang.String pMessageText) throws FlexCheckedException
pSlackAccountCode
- Messaging account code for Slack account.pChannel
- Name or Id of channel where the notification will be sent. Use user
channel Id to send direct messages.pMessageText
- Text for the message that will be sent.FlexNotFoundException
FlexCheckedException
public java.lang.String getGroovyKey()
getGroovyKey
in class BaseFunctions
public void cleanup()
cleanup
in class BaseFunctions