Skip to content

Commit cc63cc1

Browse files
committed
Closes #15315 by documenting the SlackOptions::threadTs() method
1 parent e93b922 commit cc63cc1

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed
40.8 KB
Loading

notifier/chatters.rst

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,41 @@ The result will be something like:
131131
.. image:: /_images/notifier/slack/field-method.png
132132
:align: center
133133

134-
.. versionadded:: 5.1
134+
.. versionadded:: 5.3
135135

136136
The `field()` method was introduced in Symfony 5.1.
137137

138+
Sending a Slack Message as a reply
139+
-------------------------------------------
140+
141+
To send your slack message as a reply in a thread you can use the
142+
:method:`SlackOptions::threadTs() <Symfony\\Component\\Notifier\\Bridge\\Slack\\SlackOptions::threadTs>` method::
143+
144+
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock;
145+
use Symfony\Component\Notifier\Bridge\Slack\SlackOptions;
146+
use Symfony\Component\Notifier\Message\ChatMessage;
147+
148+
$chatMessage = new ChatMessage('Symfony Feature');
149+
150+
$options = (new SlackOptions())
151+
->block((new SlackSectionBlock())->text('My reply'))
152+
->threadTs('1621592155.003100')
153+
;
154+
155+
// Add the custom options to the chat message and send the message
156+
$chatMessage->options($options);
157+
158+
$chatter->send($chatMessage);
159+
160+
The result will be something like:
161+
162+
.. image:: /_images/notifier/slack/message-reply.png
163+
:align: center
164+
165+
.. versionadded:: 5.3
166+
167+
The `threadTs()` method was introduced in Symfony 5.3.
168+
138169
Adding Interactions to a Discord Message
139170
----------------------------------------
140171

0 commit comments

Comments
 (0)