@@ -218,6 +218,99 @@ to add `message options`_::
218218
219219 $chatter->send($chatMessage);
220220
221+ Adding text to a Microsoft Teams Message
222+ ----------------------------------------
223+
224+ With a Microsoft Teams, you can use the simple ChatMessage::
225+
226+ use Symfony\Component\Notifier\Bridge\MicrosoftTeams\MicrosoftTeamsTransport;
227+ use Symfony\Component\Notifier\Message\ChatMessage;
228+
229+ $chatMessage = (new ChatMessage('Contribute To Symfony'))->transport('microsoftteams');
230+ $chatter->send($chatMessage);
231+
232+ The result will be something like:
233+
234+ .. image :: /_images/notifier/microsoft_teams/message.png
235+ :align: center
236+
237+ Adding Interactions to a Microsoft Teams Message
238+ ------------------------------------------------
239+
240+ With a Microsoft Teams Message, you can use the
241+ :class: `Symfony\\ Component\\ Notifier\\ Bridge\\ MicrosoftTeams\\ MicrosoftTeamsOptions ` class
242+ to add `MessageCard options `_::
243+
244+ use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Action\ActionCard;
245+ use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Action\HttpPostAction;
246+ use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Action\Input\DateInput;
247+ use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Action\Input\TextInput;
248+ use Symfony\Component\Notifier\Bridge\MicrosoftTeams\MicrosoftTeamsOptions;
249+ use Symfony\Component\Notifier\Bridge\MicrosoftTeams\MicrosoftTeamsTransport;
250+ use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Section\Field\Fact;
251+ use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Section\Section;
252+ use Symfony\Component\Notifier\Message\ChatMessage;
253+
254+ $chatMessage = new ChatMessage('');
255+
256+ // Action elements
257+ $input = new TextInput();
258+ $input->id('input_title');
259+ $input->isMultiline(true)->maxLength(5)->title('In a few words, why would you like to participate?');
260+
261+ $inputDate = new DateInput();
262+ $inputDate->title('Proposed date')->id('input_date');
263+
264+ // Create Microsoft Teams MessageCard
265+ $microsoftTeamsOptions = (new MicrosoftTeamsOptions())
266+ ->title('Symfony Online Meeting')
267+ ->text('Symfony Online Meeting are the events where the best developers meet to share experiences...')
268+ ->summary('Summary')
269+ ->themeColor('#F4D35E')
270+ ->section((new Section())
271+ ->title('Talk about Symfony 5.3 - would you like to join? Please give a shout!')
272+ ->fact((new Fact())
273+ ->name('Presenter')
274+ ->value('Fabien Potencier')
275+ )
276+ ->fact((new Fact())
277+ ->name('Speaker')
278+ ->value('Patricia Smith')
279+ )
280+ ->fact((new Fact())
281+ ->name('Duration')
282+ ->value('90 min')
283+ )
284+ ->fact((new Fact())
285+ ->name('Date')
286+ ->value('TBA')
287+ )
288+ )
289+ ->action((new ActionCard())
290+ ->name('ActionCard')
291+ ->input($input)
292+ ->input($inputDate)
293+ ->action((new HttpPostAction())
294+ ->name('Add comment')
295+ ->target('http://target')
296+ )
297+ )
298+ ;
299+
300+ // Add the custom options to the chat message and send the message
301+ $chatMessage->options($microsoftTeamsOptions);
302+ $chatter->send($chatMessage);
303+
304+ The result will be something like:
305+
306+ .. image :: /_images/notifier/microsoft_teams/message-card.png
307+ :align: center
308+
309+ .. versionadded :: 5.3
310+
311+ Options for Microsoft Teams were introduced in Symfony 5.3.
312+
221313.. _`Block elements` : https://api.slack.com/reference/block-kit/block-elements
222314.. _`Embed elements` : https://discord.com/developers/docs/resources/webhook
223315.. _`message options` : https://core.telegram.org/bots/api
316+ .. _`MessageCard options` : https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference
0 commit comments