- ActionStyle
- ActionStyleJsonConverter
- FormattedTextEncoder
- ICloneable`1
- IconType
- ISlackAttachmentBuilder
- WithAuthor(name,linkUrl,iconUrl)
- WithColor(hexColor)
- WithColor(color)
- WithFallback(fallback)
- WithField(title,value,isShort,enableFormatting)
- WithFooter(text,iconUrl)
- WithImage(url)
- WithLink(url)
- WithLinkButtonAction(text,url,style)
- WithPreText(text,enableFormatting)
- WithText(text,enableFormatting)
- WithThumbnail(url)
- WithTimestamp(timestamp)
- WithTimestamp(epochTime)
- WithTitle(title)
- ISlackClient
- ISlackMessageBuilder
- IValidateable
- SlackAttachment
- SlackAttachmentAction
- SlackAttachmentBuilder
- SlackAttachmentField
- SlackAttachmentLinkButtonAction
- SlackClient
- SlackMessage
- SlackMessageBuilder
- SlackMessageValidationException
- ValidationError
SlackWebhook.Enums
Action type
Turns the button red and indicates it some kind of destructive action
Turns the button green and indicates the best forward action to take
SlackWebhook.Core
ActionStylejson converter
Inherit from parent.
This method has no parameters.
Inherit from parent.
This method has no parameters.
SlackWebhook.Core
Handles escaping characters which the Slack webhook expects to be HTML encoded.
See https://api.slack.com/docs/message-formatting#how_to_escape_characters for more.
SlackWebhook.Core
Cloneable type
Name | Description |
---|---|
T | Type of clone |
Creates new clone of this instance
Cloned instance
This method has no parameters.
SlackWebhook.Enums
Icon type
Icon is a slack emoji name, e.g.
smile
Icon is a image URL
SlackWebhook
Slack attachment builder used to configure an attachment to be added to a SlackMessage
With author name, and optional link url and icon url
Name | Type | Description |
---|---|---|
name | System.String | Author name (required) |
linkUrl | System.String | Author link url (optional) |
iconUrl | System.String | Author icon url (optional) |
The author parameters will display a small section at the top of a message attachment.
A valid URL that will hyperlink the AuthorNametext mentioned above. Will only work if AuthorNameis present.
A valid URL that displays a small 16x16px image to the left of the AuthorNametext. Will only work if AuthorNameis present.
With hex-based color
Name | Type | Description |
---|---|---|
hexColor | System.String | Hex color or one of named colors (good, warning, danger) |
Like traffic signals, color-coding messages can quickly communicate intent and help separate them from the flow of other messages in the timeline.
An optional value that can either be one of good, warning, danger, or any hex color code(eg. #439FE0). This value is used to color the border along the left side of the message attachment.
With color from Colorinstance
Name | Type | Description |
---|---|---|
color | System.Drawing.Color | Color instance to set color from |
With required plain-text summary of the attachment
Name | Type | Description |
---|---|---|
fallback | System.String |
A plain-text summary of the attachment. This text will be used in clients that don't show formatted text (eg. IRC, mobile notifications) and should not contain any markup.
With attachment field shown as a table inside the message attachment
Name | Type | Description |
---|---|---|
title | System.String | Title of field |
Shown as a bold heading above the value text. It cannot contain markup and will be escaped for you. | | value | System.String | Value of field (may contain formatting if enabled)
The text value of the field. It may contain standard message markup and must be escaped as normal. May be multi-line. | | isShort | System.Boolean | Whether field can be shown side-by-side with other fields (optional) | | enableFormatting | System.Boolean | Whether or not to enable formatting for value |
If enableFormatting
is enabled, you can use Slack message formatting in
value
and it will automatically be encoded according to slack encoding rules.
With footer text and optional footer icon
Name | Type | Description |
---|---|---|
text | System.String | |
iconUrl | System.String |
Add some brief text to help contextualize and identify an attachment. Limited to 300 characters, and may be truncated further when displayed to users in environments with limited screen real estate.
To render a small icon beside your footer text, provide a publicly accessible URL string in the footer_icon field. You must also provide a footer for the field to be recognized.
We'll render what you provide at 16px by 16px. It's best to use an image that is similarly sized.
With image url
Name | Type | Description |
---|---|---|
url | System.String | Image url |
A valid URL to an image file that will be displayed inside a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.
Large images will be resized to a maximum width of 400px or a maximum height of 500px, while still maintaining the original aspect ratio.
With link on attachment title
Name | Type | Description |
---|---|---|
url | System.String |
Link of title (optional)
With link button action, shown at the bottom of the attachment
Name | Type | Description |
---|---|---|
text | System.String | Test shown on link button |
url | System.String | URL opened if link button is pressed |
style | System.Nullable{SlackWebhook.Enums.ActionStyle} | Optional style |
An attachment may contain multiple actions
With optional pre-text
Name | Type | Description |
---|---|---|
text | System.String | Pre-text |
enableFormatting | System.Boolean | Whether or not to enable formatting for text |
This is optional text that appears above the message attachment block.
With optional text
Name | Type | Description |
---|---|---|
text | System.String | Text |
enableFormatting | System.Boolean | Whether or not to enable formatting for text |
This is the main text in a message attachment, and can contain standard message markup. The content will automatically collapse if it contains 700+ characters or 5+ linebreaks, and will display a "Show more..." link to expand the content. Links posted in the text field will not unfurl.
If enableFormatting
is enabled, you can use Slack message formatting in
text
and it will automatically be encoded according to slack encoding rules.
With thumbnail url
Name | Type | Description |
---|---|---|
url | System.String | Thumbnail url |
A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.
The thumbnail's longest dimension will be scaled down to 75px while maintaining the aspect ratio of the image. The filesize of the image must also be less than 500 KB.
For best results, please use images that are already 75px by 75px.
With timestamp based on timestamp
Name | Type | Description |
---|---|---|
timestamp | System.DateTimeOffset | DateTimeOffset to set timestamp from |
Does your attachment relate to something happening at a specific time?
By providing the ts field with an integer value in "epoch time", the attachment will display an additional timestamp value as part of the attachment's footer.
Use ts when referencing articles or happenings.Your message will have its own timestamp when published.
Example: Providing 123456789 would result in a rendered timestamp of Nov 29th, 1973.
With epoc timestamp
Name | Type | Description |
---|---|---|
epochTime | System.Int32 | Epoch timestamp |
Does your attachment relate to something happening at a specific time?
By providing the ts field with an integer value in "epoch time", the attachment will display an additional timestamp value as part of the attachment's footer.
Use ts when referencing articles or happenings.Your message will have its own timestamp when published.
Example: Providing 123456789 would result in a rendered timestamp of Nov 29th, 1973.
With required title
Name | Type | Description |
---|---|---|
title | System.String | Title |
The title is displayed as larger, bold text near the top of a message attachment. By passing a valid URL in the TitleLinkparameter (optional), the title text will be
SlackWebhook
Slack client
Send new SlackMessageby configuring the provided ISlackMessageBuilder
Name | Type | Description |
---|---|---|
configureBuilder | System.Action{SlackWebhook.ISlackMessageBuilder} | Configure message to send using this builder |
Name | Description |
---|---|
SlackWebhook.Exceptions.SlackMessageValidationException | Thrown if validation of the message fails, such as if a required field is missing. |
Uses Validateto perform validation. |
Send the provided SlackMessage
Name | Type | Description |
---|---|---|
message | SlackWebhook.Messages.SlackMessage | Slack message to send |
Name | Description |
---|---|
SlackWebhook.Exceptions.SlackMessageValidationException | Thrown if validation of the message fails, such as if a required field is missing. |
Uses Validateto perform validation. |
SlackWebhook
Slack message builder that produces SlackMessageinstances based on the builder's current configuration.
Build SlackMessagebased on current state of the builder
New message
This method has no parameters.
Name | Description |
---|---|
SlackWebhook.Exceptions.SlackMessageValidationException | Thrown if validation of the message fails, such as if a required field is missing. |
Uses Validateto perform validation. |
With attachment build with provided attachment builder
Name | Type | Description |
---|---|---|
configureAttachment | System.Action{SlackWebhook.ISlackAttachmentBuilder} | Attachment builder |
Adds a new SlackAttachmentto Attachmentsbuilt using provided ISlackAttachmentBuilder
With channel
Name | Type | Description |
---|---|---|
channel | System.String | The channel. |
Sets the Channelproperty
With icon (url or emoji)
Name | Type | Description |
---|---|---|
iconType | SlackWebhook.Enums.IconType | Type of icon |
urlOrEmoji | System.String | URL or emoji name (depending on iconType ) |
Sets the IconUrlor IconEmojibased on
iconType
with the provided value urlOrEmoji
With required message text
Name | Type | Description |
---|---|---|
text | System.String | Message text |
enableFormatting | System.Boolean | Whether or not to enable formatting for text |
Sets the Textand EnableFormattingproperties.
If enableFormatting
is enabled, you can use Slack message formatting in
text
and it will automatically be encoded according to slack encoding rules.
With username
Name | Type | Description |
---|---|---|
username | System.String | Username |
Sets the Usernameproperty
SlackWebhook.Core
Object can be validated
Validates the current state of the object (including any nested validateable members)
True if the object is valid, false otherwise
Name | Type | Description |
---|---|---|
validationErrors | System.Collections.Generic.ICollection{SlackWebhook.Exceptions.ValidationError}@ | Validation errors (if any found) |
Will find all (if any) validation errors and populate validationErrors
with each
SlackWebhook.Messages
Optional attachment to a SlackMessage.
See https://api.slack.com/docs/message-attachments for more details
Used to enable formatting of the Fieldsvalue fields
Used to enable formatting of the PreTextfield
Used to enable formatting of the Textfield
Actions shown at the bottom of the message (optional)
Author icon URL (optional)
A valid URL that displays a small 16x16px image to the left of the AuthorNametext. Will only work if AuthorNameis present.
Author link (optional)
A valid URL that will hyperlink the AuthorNametext mentioned above. Will only work if AuthorNameis present.
Author name (optional)
The author parameters will display a small section at the top of a message attachment
Gets or sets the color.
Like traffic signals, color-coding messages can quickly communicate intent and help separate them from the flow of other messages in the timeline.
An optional value that can either be one of good, warning, danger, or any hex color code(eg. #439FE0). This value is used to color the border along the left side of the message attachment.
Enable formatting for various fields of the attachment, use FormattingText, FormattingPretextand FormattingFieldsto contorl which fields have formatting enabled.
Required plain-text summary of the attachment
A plain-text summary of the attachment. This text will be used in clients that don't show formatted text (eg. IRC, mobile notifications) and should not contain any markup.
Fields shown as a table inside the message attachment (optional)
Footer text shown at the bottom of attachment (optional)
Add some brief text to help contextualize and identify an attachment. Limited to 300 characters, and may be truncated further when displayed to users in environments with limited screen real estate.
Icon shown left of footer text (optional)
To render a small icon beside your footer text, provide a publicly accessible URL string in the footer_icon field. You must also provide a footer for the field to be recognized.
We'll render what you provide at 16px by 16px. It's best to use an image that is similarly sized.
Image url (optional)
A valid URL to an image file that will be displayed inside a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.
Large images will be resized to a maximum width of 400px or a maximum height of 500px, while still maintaining the original aspect ratio.
Optional text that appears above the attachment block
This is optional text that appears above the message attachment block.
Optional text that appears within the attachment
This is the main text in a message attachment, and can contain standard message markup. The content will automatically collapse if it contains 700+ characters or 5+ linebreaks, and will display a "Show more..." link to expand the content. Links posted in the text field will not unfurl.
Thumbnail url (optional)
A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.
The thumbnail's longest dimension will be scaled down to 75px while maintaining the aspect ratio of the image. The filesize of the image must also be less than 500 KB.
For best results, please use images that are already 75px by 75px.
Timestamp (epoch time) shown below attachment (optional)
Does your attachment relate to something happening at a specific time?
By providing the ts field with an integer value in "epoch time", the attachment will display an additional timestamp value as part of the attachment's footer.
Use ts when referencing articles or happenings.Your message will have its own timestamp when published.
Example: Providing 123456789 would result in a rendered timestamp of Nov 29th, 1973.
Title of attachment (required)
The title is displayed as larger, bold text near the top of a message attachment. By passing a valid URL in the TitleLinkparameter (optional), the title text will be hyperlinked.
Link of title (optional)
Inherit from parent.
This method has no parameters.
Set color hex code from Color
Name | Type | Description |
---|---|---|
color | System.Drawing.Color | Color to set color hex from |
Set Timestampepoch value based on provided date time
Name | Type | Description |
---|---|---|
timestamp | System.DateTimeOffset | Timestamp to set epohc time from |
Inherit from parent.
This method has no parameters.
SlackWebhook.Messages
Optional action to se SlackAttachment.
Initialize attachment action
Name | Type | Description |
---|---|---|
type | System.String | Type of action |
Text displayed for the action
How this is presented depends on the type of action
Type of action
Inherit from parent.
This method has no parameters.
Inherit from parent.
This method has no parameters.
SlackWebhook
Enables or disables formatting by adding/removing formattingType
from
EnableFormatting
Name | Type | Description |
---|---|---|
formattingType | System.String | Formatting type |
enable | System.Boolean | Whether to enable (add) or disable (remove) |
SlackWebhook.Messages
Optional attachment field added to Fields
Whether field can be shown side-by-side with other fields (optional)
Title of field
Shown as a bold heading above the value text. It cannot contain markup and will be escaped for you.
Value of field (may contain formatting if enabled)
The text value of the field. It may contain standard message markup and must be escaped as normal. May be multi-line.
Inherit from parent.
This method has no parameters.
Inherit from parent.
This method has no parameters.
SlackWebhook.Messages
Button action which will open a Url, if clicked
Create new empty link button action
This constructor has no parameters.
Optional style
URL to open if link button is clicked
Inherit from parent.
This method has no parameters.
Inherit from parent.
This method has no parameters.
SlackWebhook
Inherit from parent.
Inherit from parent.
This constructor has no parameters.
Inherit from parent.
This method has no parameters.
Inherit from parent.
This method has no parameters.
SlackWebhook.Messages
Basis for a Slack message which can be sent to the webhook URL
Attachments to show below message (optional)
Channel the message is posted into (optional)
Whether or not to enable formatting for this message
Default true
Icon emoji name () (optional)
Either provide this OR IconUrl, but not both
Icon URL to show before username (optional)
Either provide this OR IconEmoji, but not both
Message text which may contain formatting (unless EnableFormattingis deactivated) and can span multiple lines.
You can use the regular Slack formatting
*bold* `code` _italic_ ~strike~
and also include links
<URL|title>
Username shown (optional)
Inherit from parent.
This method has no parameters.
Checks the current state using Validateand throws a SlackMessageValidationExceptionwith all validations errors, if any are found.
This method has no parameters.
Inherit from parent.
This method has no parameters.
SlackWebhook
Inherit from parent.
Create new slack message builder
This constructor has no parameters.
Inherit from parent.
This method has no parameters.
Inherit from parent.
This method has no parameters.
Inherit from parent.
This method has no parameters.
Inherit from parent.
This method has no parameters.
Inherit from parent.
This method has no parameters.
Inherit from parent.
This method has no parameters.
SlackWebhook.Exceptions
Slack message validation exception
Create new validation exception
Name | Type | Description |
---|---|---|
message | System.String | Exception message |
validationErrors | System.Collections.Generic.IEnumerable{SlackWebhook.Exceptions.ValidationError} | Validation errors |
Validations errors
SlackWebhook.Exceptions
Validation error details
Create new validation error
Name | Type | Description |
---|---|---|
typeName | System.String | Type where validation error occurred |
propertyName | System.String | Property which failed validation |
error | System.String | Validation error |
Validation error
Property which failed validation
Type where validation error occurred
Inherit from parent.
This method has no parameters.