public class FlexSlackMessage extends SlackRequestPojo
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FAILURE_COLOR |
static java.lang.String |
SUCCESS_COLOR |
Constructor and Description |
---|
FlexSlackMessage() |
FlexSlackMessage(java.lang.String pMessage,
java.lang.String pIconEmoji,
java.lang.String pColor) |
Modifier and Type | Method and Description |
---|---|
void |
addAdditionalField(java.lang.String pKey,
java.lang.String pValue)
Adds an additional key/value item below the message header.
|
void |
addAdditionalField(java.lang.String pKey,
java.lang.String pValue,
java.lang.Boolean pIsShort)
Adds an additional key/value item below the message header.
|
void |
addButton(java.lang.String pBtnText,
java.lang.String pStyle,
java.lang.String pAction,
java.lang.Object pValue)
Adds a button to the slack message, each button will show up in a button row between the header
and key/value details
|
void |
clearAdditionalFields()
Clears all additional fields that have been added to the message
|
java.lang.String |
getColor() |
void |
setColor(java.lang.String pColor)
Set a color theme for the message, note this color only shows up if the slack message has
additional fields
|
java.lang.String |
toString()
Convert this Object to a Json string representation with no formatting
|
java.lang.String |
toString(int pIndentFactor)
Convert this Object to a Json string representation with the given indent factor
|
getChannel, getIconEmoji, getIconURL, getMessageJson, getText, getUsername, setChannel, setIconEmoji, setIconURL, setText, setUsername
public static final java.lang.String SUCCESS_COLOR
public static final java.lang.String FAILURE_COLOR
public FlexSlackMessage(java.lang.String pMessage, java.lang.String pIconEmoji, java.lang.String pColor)
pMessage
- Header level text/messagepIconEmoji
- Icon to place in header messagepColor
- Color to give this message - will only be used if additional fields are
presentpublic FlexSlackMessage()
public void setColor(java.lang.String pColor)
pColor
- Any valid css color stringpublic java.lang.String getColor()
public void addButton(java.lang.String pBtnText, java.lang.String pStyle, java.lang.String pAction, java.lang.Object pValue)
pBtnText
- Text/name of the buttonpStyle
- Style for the button, only options are 'danger', 'primary', or 'default'pAction
- Any string value representing the action of the button. This value will be
passed back in webhooks. E.G 'approve', 'reject'.pValue
- Any value to associate with this button. This is usually an id or name in
another system. Task Id or Object Name. This is also passed back in webhooks.public void clearAdditionalFields()
public void addAdditionalField(java.lang.String pKey, java.lang.String pValue, java.lang.Boolean pIsShort)
pKey
- keypValue
- valuepIsShort
- If short is true then two fields will fit on a single rowpublic void addAdditionalField(java.lang.String pKey, java.lang.String pValue)
pKey
- keypValue
- valuepublic java.lang.String toString()
public java.lang.String toString(int pIndentFactor)
pIndentFactor
- The indent factor when formatting the json payload