Skip to content

Commit 7d1d15d

Browse files
committed
Add docs for Microsoft Teams Options
1 parent b989cc5 commit 7d1d15d

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

notifier/chatters.rst

+38
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,44 @@ to add `message options`_::
218218

219219
$chatter->send($chatMessage);
220220

221+
Adding Options to a Microsoft Teams Message
222+
-------------------------------------------
223+
224+
With a Microsoft Teams message, you can use the
225+
:class:`Symfony\\Component\\Notifier\\Bridge\\MicrosoftTeams\\MicrosoftTeamsOptions` class
226+
to add `options`_::
227+
228+
use Symfony\Component\Notifier\Bridge\MicrosoftTeams\MicrosoftTeamsOptions;
229+
use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Section\Field\Image;
230+
use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Section\Section;
231+
use Symfony\Component\Notifier\Message\ChatMessage;
232+
233+
$chatMessage = new ChatMessage('');
234+
235+
// Create MicrosoftTeams options
236+
$options = (new MicrosoftTeamsOptions())
237+
->title('Hey all!')
238+
->summary('**A big thank you**') // you can use Markdown here
239+
->text('Lets celebrate the release of Symfony 5.3 all together!')
240+
->themeColor('FF0000');
241+
242+
$options->section((new Section())
243+
->image((new Image())
244+
->image('https://symfony.com/logo.png')
245+
->title('The Symfony Logo')
246+
)
247+
);
248+
249+
// Add the custom options to the chat message and send the message
250+
$chatMessage->options($options);
251+
252+
$chatter->send($chatMessage);
253+
254+
.. versionadded:: 5.3
255+
256+
Options for Microsoft Teams were introduced in Symfony 5.3.
257+
221258
.. _`Block elements`: https://api.slack.com/reference/block-kit/block-elements
222259
.. _`Embed elements`: https://discord.com/developers/docs/resources/webhook
223260
.. _`message options`: https://core.telegram.org/bots/api
261+
.. _`options`: https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference

0 commit comments

Comments
 (0)