Package flexagon.ffi.slack.pojos
Class FlexSlackMessage
java.lang.Object
flexagon.ff.common.core.pojos.BasePOJO
flexagon.ffi.slack.pojos.SlackRequestPojo
flexagon.ffi.slack.pojos.FlexSlackMessage
- All Implemented Interfaces:
Serializable
An object representing a nicely formatted slack message. Set relevant fields with setters and
adds. Finally call the toString method to
return the json representation which can be sent via API call to slack.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAdditionalField(String pKey, String pValue) Adds an additional key/value item below the message header.voidaddAdditionalField(String pKey, String pValue, Boolean pIsShort) Adds an additional key/value item below the message header.voidAdds a button to the slack message, each button will show up in a button row between the header and key/value detailsvoidClears all additional fields that have been added to the messagegetColor()voidSet a color theme for the message, note this color only shows up if the slack message has additional fieldstoString()Convert this Object to a Json string representation with no formattingtoString(int pIndentFactor) Convert this Object to a Json string representation with the given indent factorMethods inherited from class flexagon.ffi.slack.pojos.SlackRequestPojo
getChannel, getIconEmoji, getIconURL, getMessageJson, getText, getUsername, setChannel, setIconEmoji, setIconURL, setText, setUsername
-
Field Details
-
SUCCESS_COLOR
- See Also:
-
FAILURE_COLOR
- See Also:
-
-
Constructor Details
-
FlexSlackMessage
- Parameters:
pMessage- Header level text/messagepIconEmoji- Icon to place in header messagepColor- Color to give this message - will only be used if additional fields are present
-
FlexSlackMessage
public FlexSlackMessage()
-
-
Method Details
-
setColor
Set a color theme for the message, note this color only shows up if the slack message has additional fields- Parameters:
pColor- Any valid css color string
-
getColor
-
addButton
Adds a button to the slack message, each button will show up in a button row between the header and key/value details- Parameters:
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.
-
clearAdditionalFields
public void clearAdditionalFields()Clears all additional fields that have been added to the message -
addAdditionalField
Adds an additional key/value item below the message header.- Parameters:
pKey- keypValue- valuepIsShort- If short is true then two fields will fit on a single row
-
addAdditionalField
Adds an additional key/value item below the message header.- Parameters:
pKey- keypValue- value
-
toString
Convert this Object to a Json string representation with no formatting -
toString
Convert this Object to a Json string representation with the given indent factor- Parameters:
pIndentFactor- The indent factor when formatting the json payload- Returns:
-