Copied!
  • mixin Message
CloneableInstantiable
Methods
public __call( $name, $arguments)
 

Pass any unhandled methods through to a new Message instance.

  • param string $name The name of the method
  • param array $arguments The method arguments
  • return $this|mixed
public __construct( $endpoint, array $options = [], ?GuzzleHttp\Client $guzzle = NULL)
 

Instantiate a new Client.

  • param string $endpoint
  • param array $options
  • param \GuzzleHttp\Client|null $guzzle
  • throws \InvalidArgumentException
  • throws \RuntimeException
public createMessage()
 

Create a new message with defaults.

  • return \Maknz\Slack\Message
public getAllowMarkdown()
 

Get whether message text should be formatted with Slack's Markdown-like language.

  • return bool
public getDefaultChannel()
 

Get the default channel messages will be created for.

  • return string
public getDefaultIcon()
 

Get the default icon messages will be created with.

  • return string
public getDefaultUsername()
 

Get the default username messages will be created for.

  • return string
public getEndpoint()
 

Get the Slack endpoint.

  • return string
public getLinkNames()
 

Get whether messages sent will have names (like @regan) will be converted into links.

  • return bool
public getMarkdownInAttachments()
 

Get the attachment fields which should be formatted in Slack's Markdown-like language.

  • return array
public getMessage()
 
  • return \Message
public getResponseType()
 

Get whether the response should be viewable by others when posted to a channel. 'ephemeral' | 'in_channel'.

  • return string
public getUnfurlLinks()
 

Get whether text links should be unfurled.

  • return bool
public getUnfurlMedia()
 

Get whether media links should be unfurled.

  • return bool
public preparePayload(Maknz\Slack\Message $message)
 

Prepares the payload to be sent to the webhook.

  • param \Maknz\Slack\Message $message The message to send
  • return array
public send( $text = NULL)
 

Send the message.

  • param string|\Maknz\Slack\Message $text The text to send
  • return \Maknz\Slack\Message
  • throws \RuntimeException
public sendMessage(Maknz\Slack\Message $message)
 

Send a message.

  • internal will become protected
  • param \Maknz\Slack\Message $message
  • throws \RuntimeException
public setAllowMarkdown( $value)
 

Set whether message text should be formatted with Slack's Markdown-like language.

  • param bool $value
  • return void
public setDefaultChannel( $channel)
 

Set the default channel messages will be created for.

  • param string $channel
  • return void
public setDefaultIcon( $icon)
 

Set the default icon messages will be created with.

  • param string $icon
  • return void
public setDefaultUsername( $username)
 

Set the default username messages will be created for.

  • param string $username
  • return void
public setEndpoint( $endpoint)
 

Set the Slack endpoint.

  • param string $endpoint
  • return void
public setLinkNames( $value)
 

Set whether messages sent will have names (like @regan) will be converted into links.

  • param bool $value
  • return void
public setMarkdownInAttachments(array $fields)
 

Set the attachment fields which should be formatted in Slack's Markdown-like language.

  • param array $fields
  • return void
public setOption( $option, $value)
 
  • param mixed $option
  • param mixed $value
public setOptions(array $options)
 
  • param array $options
  • return \Maknz\Slack\Client
public setResponseType( $value)
 

Set whether the response should be viewable by others when posted to a channel. 'ephemeral' | 'in_channel'.

  • param string $value
  • return void
public setUnfurlLinks( $value)
 

Set whether text links should be unfurled.

  • param bool $value
  • return void
public setUnfurlMedia( $value)
 

Set whether media links should be unfurled.

  • param bool $value
  • return void
Properties
protected $allow_markdown = true
 

Whether message text should be formatted with Slack's Markdown-like language.

  • var bool
protected $channel = NULL
 

The default channel to send messages to.

  • var string
protected $endpoint = NULL
 

The Slack incoming webhook endpoint.

  • var string
protected $guzzle = NULL
 

The Guzzle HTTP client instance.

  • var \GuzzleHttp\Client
protected $icon = NULL
 

The default icon to send messages with.

  • var string
protected $link_names = false
 

Whether to link names like @regan or leave them as plain text.

  • var bool
protected $markdown_in_attachments = []
 

The attachment fields which should be formatted with Slack's Markdown-like language.

  • var array
protected $message = NULL
 
  • var \Message
protected static $optionSetter = ['channel' => 'setDefaultChannel', 'username' => 'setDefaultUsername', 'icon' => 'setDefaultIcon', 'response_type' => 'setResponseType', 'link_names' => 'setLinkNames', 'unfurl_links' => 'setUnfurlLinks', 'unfurl_media' => 'setUnfurlMedia', 'allow_markdown' => 'setAllowMarkdown', 'markdown_in_attachments' => 'setMarkdownInAttachments']
 

Option name to setter method map.

  • var array
protected $response_type = 'ephemeral'
 

Whether the response should be viewable by others when posted to a channel. 'ephemeral' | 'in_channel'.

  • var string
protected $unfurl_links = false
 

Whether Slack should unfurl text-based URLs.

  • var bool
protected $unfurl_media = true
 

Whether Slack should unfurl media URLs.

  • var bool
protected $username = NULL
 

The default username to send messages as.

  • var string
Methods
protected getAttachmentsAsArrays(Maknz\Slack\Message $message)
 

Get the attachments in array form.

  • param \Maknz\Slack\Message $message
  • return array
protected getOrCreateMessage()
 
  • return \Message
Methods
private static getOptionSetter(string $option)
 

Returns property setter method by given option name.

  • param string $option
  • return mixed|null
Properties
protected static $optionSetter = ['channel' => 'setDefaultChannel', 'username' => 'setDefaultUsername', 'icon' => 'setDefaultIcon', 'response_type' => 'setResponseType', 'link_names' => 'setLinkNames', 'unfurl_links' => 'setUnfurlLinks', 'unfurl_media' => 'setUnfurlMedia', 'allow_markdown' => 'setAllowMarkdown', 'markdown_in_attachments' => 'setMarkdownInAttachments']
 

Option name to setter method map.

  • var array
Methods
private static getOptionSetter(string $option)
 

Returns property setter method by given option name.

  • param string $option
  • return mixed|null
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration