Skip to content

[Notifier] Add docs for Microsoft Teams Options #15232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add docs for Microsoft Teams Options
  • Loading branch information
OskarStark committed Apr 20, 2021
commit c90e822d0e89c4ff4c1f57230801f9885d0ca7cc
38 changes: 38 additions & 0 deletions notifier/chatters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,44 @@ to add `message options`_::

$chatter->send($chatMessage);

Adding Options to a Microsoft Teams Message
-------------------------------------------

With a Microsoft Teams message, you can use the
:class:`Symfony\\Component\\Notifier\\Bridge\\MicrosoftTeams\\MicrosoftTeamsOptions` class
to add `options`_::

use Symfony\Component\Notifier\Bridge\MicrosoftTeams\MicrosoftTeamsOptions;
use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Section\Field\Image;
use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Section\Section;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('');

// Create MicrosoftTeams options
$options = (new MicrosoftTeamsOptions())
->title('Hey all!')
->summary('**A big thank you**') // you can use Markdown here
->text('Lets celebrate the release of Symfony 5.3 all together!')
->themeColor('FF0000');

$options->section((new Section())
->image((new Image())
->image('https://symfony.com/logo.png')
->title('The Symfony Logo')
)
);

// Add the custom options to the chat message and send the message
$chatMessage->options($options);

$chatter->send($chatMessage);

.. versionadded:: 5.3

Options for Microsoft Teams were introduced in Symfony 5.3.

.. _`Block elements`: https://api.slack.com/reference/block-kit/block-elements
.. _`Embed elements`: https://discord.com/developers/docs/resources/webhook
.. _`message options`: https://core.telegram.org/bots/api
.. _`options`: https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference