@@ -177,3 +177,44 @@ Messages higher-level API::
177177 $message = new ChatMessage('Default Text', $options);
178178
179179 $dsn = 'all(slack://TOKEN@default?channel=CHANNEL telegram://TOKEN@default?channel=CHAT_ID)';
180+
181+ Slack Actions Block for Slack Message
182+ -------------------------------------
183+
184+ With a Slack Message you can add some interactive options called `Block elements `_::
185+
186+ use Symfony\Component\Notifier\Bridge\Slack\Block\SlackActionsBlock;
187+ use Symfony\Component\Notifier\Bridge\Slack\SlackOptions;
188+ use Symfony\Component\Notifier\Message\ChatMessage;
189+ use Symfony\Component\Notifier\Chatter;
190+ use Symfony\Component\Notifier\Bridge\Slack\SlackTransport;
191+
192+ // Initialize a chatter with Slack Transport
193+ $chatter = new Chatter(new SlackTransport('token'));
194+
195+ // Create a message
196+ $chatMessage = (new ChatMessage())
197+ ->subject('Contribute To Symfony');
198+
199+ // Create Slack Actions Block and add some buttons
200+ $contributeToSymfonyBlocks = (new SlackActionsBlock())
201+ ->button(
202+ 'Improve Documentation',
203+ 'https://symfony.com/doc/current/contributing/documentation/standards.html',
204+ 'primary'
205+ )
206+ ->button(
207+ 'Report bugs',
208+ 'https://symfony.com/doc/current/contributing/code/bugs.html',
209+ 'danger'
210+ );
211+ $contributeToSymfonyOptions = (new SlackOptions())->block($contributeToSymfonyBlocks);
212+
213+ // Add the Buttons as Options to the Message
214+ $chatMessage->options($contributeToSymfonyOptions);
215+
216+ // And then send the Message
217+ $chatter->send($chatMessage);
218+
219+
220+ .. _`Block elements` : https://api.slack.com/reference/block-kit/block-elements
0 commit comments