'short' => true // whether the field is short enough to sit side-by-side other fields, defaults to false Send an attachment with fields ( preview) $client->to('#operations')->attach([ ])->send('New alert from the monitoring system') // no message, but can be provided if you'd like Send an attachment ( preview) $client->to('#operations')->attach([
$client->to('#accounting')->withIcon('')->send('Some accounting notification') Sending a message with a different icon ( preview) // Either with a Slack or a URL Sending a message to a user a message to a channel as a different bot name ( preview) $client->from('Jake the time!') Sending a message to a non-default channel $client->to('#accounting')->send('Are we rich yet?') Sending a basic message ( preview) $client->send('Hello world!') Which attachment fields should have markdown parsed (defaults to none) Whether markdown should be parsed in messages, or left as plain text (defaults to true) Whether Slack should unfurl media-based URLs, like tweets or Youtube videos (defaults to true) Whether Slack should unfurl text-based URLs (defaults to false) Whether names like or #accounting should be linked in the message (defaults to false) Whether to show the response in the channel to all members or privately ('ephemeral' The default icon that messages will be sent with, either :emoji: or a URL to an image The default channel that messages will be sent to Where not provided, we'll fallback to what is configured on the webhook integration, which are managed at Slack, or our sensible defaults.
All settings are optional and you don't need to provide any. The default settings are pretty good, but you may wish to set up default behaviour for your client to be used for all messages sent. $client = new Maknz\Slack\Client('.', $settings) use response_type (in_channel | ephemeral) to denote whether the message will be visible Any names like or #channel will also be linked. will be sent from 'Cyril' and to the #accounting channel Instantiate with defaults, so all messages created Instantiate the client // Instantiate without defaults You'll need the webhook URL to instantiate the client (or for the configuration file if using Laravel). Then create an incoming webhook on your Slack account for the package to use.
MAKNZ SLACK CLIENT START A THREAD INSTALL
You can install the package using the Composer package manager by running in your project root: composer require alek13/slack $client = new Client(' $client->to('#general')->send('Good morning')
MAKNZ SLACK CLIENT START A THREAD CODE
This is the fork of popular, great, but abandoned package maknz/slack Quick TourĬreate an incoming webhook & copy hook_urlĪdd the following code use Maknz\Slack\Client A simple PHP package for sending messages to Slackįocused on ease-of-use and elegant syntax.