@@ -175,6 +175,49 @@ The result will be something like:
175
175
176
176
The `SlackHeaderBlock ` class was introduced in Symfony 5.3.
177
177
178
+ Adding a footer to a Slack Message
179
+ -------------------------------------------
180
+
181
+ To add a footer to your message you can use the
182
+ :class: `Symfony\\ Component\\ Notifier\\ Bridge\\ Slack\\ Block\\ SlackContextBlock ` class::
183
+
184
+ use Symfony\Component\Notifier\Bridge\Slack\Block\SlackContextBlock;
185
+ use Symfony\Component\Notifier\Bridge\Slack\Block\SlackDividerBlock;
186
+ use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock;
187
+ use Symfony\Component\Notifier\Bridge\Slack\SlackOptions;
188
+ use Symfony\Component\Notifier\Message\ChatMessage;
189
+
190
+ $chatMessage = new ChatMessage('Symfony Feature');
191
+
192
+ $contextBlock = (new SlackContextBlock())
193
+ ->text('My Context')
194
+ ->image('https://symfony.com/logos/symfony_white_03.png', 'Symfony Logo')
195
+ ;
196
+
197
+ $options = (new SlackOptions())
198
+ ->block((new SlackSectionBlock())->text('My message'))
199
+ ->block(new SlackDividerBlock())
200
+ ->block(
201
+ (new SlackSectionBlock())
202
+ ->field('*Max Rating*')
203
+ ->field('5.0')
204
+ ->field('*Min Rating*')
205
+ ->field('1.0')
206
+ )
207
+ ->block($contextBlock)
208
+ ;
209
+
210
+ $chatter->send($chatMessage);
211
+
212
+ The result will be something like:
213
+
214
+ .. image :: /_images/notifier/slack/slack-footer.png
215
+ :align: center
216
+
217
+ .. versionadded :: 5.3
218
+
219
+ The `SlackContextBlock ` class was introduced in Symfony 5.3.
220
+
178
221
Sending a Slack Message as a reply
179
222
-------------------------------------------
180
223
0 commit comments