Overview
  • Namespace
  • Class

Namespaces

  • Slack
    • Message

Classes

  • Attachment
  • AttachmentBuilder
  • AttachmentField
  • Message
  • MessageBuilder

Class AttachmentBuilder

A builder object for creating new message attachment objects.

Namespace: Slack\Message
Located at Message/AttachmentBuilder.php

Methods summary

public
# setTitle( string $title, string $link = null )

Sets the attachment title with an optional link.

Sets the attachment title with an optional link.

Parameters

$title
The attachment title text.
$link
An optional URL the title should link to.

Returns


$this
public
# setText( string $text, boolean $markdown = false )

Sets the main text of the attachment.

Sets the main text of the attachment.

Parameters

$text
The attachment text.
$markdown
Enables or disables Markdown parsing in the text.

Returns


$this
public
# setFallbackText( string $fallbackText )

Sets a plain-text summary of the attachment.

Sets a plain-text summary of the attachment.

This text will be used in clients that don't show formatted text.

Parameters

$fallbackText
The fallback text.

Returns


$this
public
# setPretext( string $pretext, boolean $markdown = false )

Sets the attachment pretext.

Sets the attachment pretext.

This is optional text that appears above the message attachment block.

Parameters

$pretext
The attachment pretext.
$markdown
Enables or disables Markdown parsing in the pretext.

Returns


$this
public
# setColor( string $color )

Sets the attachment border color.

Sets the attachment border color.

Parameters

$color
The attachment border color. Can be "good", "warning", "danger", or a hex color code.

Returns


$this
public
# setAuthor( string $name, string $link = null, string $icon = null )

Sets the message author.

Sets the message author.

Parameters

$name
The author name.
$link
An optional URL that the author text should link to.
$icon
An optional URL to an image to show to the left of the author name.

Returns


$this
public
# setImageUrl( string $url )

Sets the URL to an image to display in the attachment body.

Sets the URL to an image to display in the attachment body.

Parameters

$url
The image URL.

Returns


$this
public
# setThumbUrl( string $url )

Sets the URL to an image to display as a thumbnail.

Sets the URL to an image to display as a thumbnail.

Parameters

$url
The thumbnail URL.

Returns


$this
public
# setFooter( string $text, string $icon = null )

Sets an attachment footer shown beneath the attachment body.

Sets an attachment footer shown beneath the attachment body.

Parameters

$text
Brief footer text.
$icon
An optional URL to an image to show to the left of the footer text.

Returns


$this
public
# setTimestamp( DateTime $time )

Sets an additional timestamp to show in the attachment footer.

Sets an additional timestamp to show in the attachment footer.

Parameters

$time
A timestamp.

Returns


$this
public
# addField( Slack\Message\AttachmentField $field )

Adds a field to the attachment.

Adds a field to the attachment.

Parameters

$field
The field to add.

Returns


$this
public
# enableMarkdownFields( boolean $enable = true )

Enables or disables Markdown parsing in fields.

Enables or disables Markdown parsing in fields.

Parameters

$enable
Whether Markdown should be enabled.

Returns


$this
public Slack\Message\Attachment
# create( )

Creates and returns a new attachment object specified by the builder.

Creates and returns a new attachment object specified by the builder.

Returns

Slack\Message\Attachment
A new attachment object.
API documentation generated by ApiGen