diff --git a/notifier.rst b/notifier.rst index d455c47c056..f1746ffb7b0 100644 --- a/notifier.rst +++ b/notifier.rst @@ -228,7 +228,7 @@ integration with these chat services: Service Package DSN ======================================= ==================================== ============================================================================= `AmazonSns`_ ``symfony/amazon-sns-notifier`` ``sns://ACCESS_KEY:SECRET_KEY@default?region=REGION`` -:doc:`Discord ` ``symfony/discord-notifier`` ``discord://TOKEN@default?webhook_id=ID`` +`Discord`_ ``symfony/discord-notifier`` ``discord://TOKEN@default?webhook_id=ID`` `FakeChat`_ ``symfony/fake-chat-notifier`` ``fakechat+email://default?to=TO&from=FROM`` or ``fakechat+logger://default`` `Firebase`_ ``symfony/firebase-notifier`` ``firebase://USERNAME:PASSWORD@default`` `Gitter`_ ``symfony/gitter-notifier`` ``gitter://TOKEN@default?room_id=ROOM_ID`` @@ -236,10 +236,10 @@ Service Package D `LinkedIn`_ ``symfony/linked-in-notifier`` ``linkedin://TOKEN:USER_ID@default`` `Mattermost`_ ``symfony/mattermost-notifier`` ``mattermost://ACCESS_TOKEN@HOST/PATH?channel=CHANNEL`` `Mercure`_ ``symfony/mercure-notifier`` ``mercure://HUB_ID?topic=TOPIC`` -:doc:`MicrosoftTeams ` ``symfony/microsoft-teams-notifier`` ``microsoftteams://default/PATH`` +`MicrosoftTeams`_ ``symfony/microsoft-teams-notifier`` ``microsoftteams://default/PATH`` `RocketChat`_ ``symfony/rocket-chat-notifier`` ``rocketchat://TOKEN@ENDPOINT?channel=CHANNEL`` -:doc:`Slack ` ``symfony/slack-notifier`` ``slack://TOKEN@default?channel=CHANNEL`` -:doc:`Telegram ` ``symfony/telegram-notifier`` ``telegram://TOKEN@default?channel=CHAT_ID`` +`Slack`_ ``symfony/slack-notifier`` ``slack://TOKEN@default?channel=CHANNEL`` +`Telegram`_ ``symfony/telegram-notifier`` ``telegram://TOKEN@default?channel=CHAT_ID`` `Zulip`_ ``symfony/zulip-notifier`` ``zulip://EMAIL:TOKEN@HOST?channel=CHANNEL`` ====================================== ==================================== ============================================================================= @@ -914,6 +914,7 @@ is dispatched. Listeners receive a .. _`AllMySms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/AllMySms/README.md .. _`AmazonSns`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/AmazonSns/README.md .. _`Clickatell`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Clickatell/README.md +.. _`Discord`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Discord/README.md .. _`Esendex`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Esendex/README.md .. _`FakeChat`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/FakeChat/README.md .. _`FakeSms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/FakeSms/README.md @@ -931,6 +932,7 @@ is dispatched. Listeners receive a .. _`Mercure`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Mercure/README.md .. _`MessageBird`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/MessageBird/README.md .. _`MessageMedia`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/MessageMedia/README.md +.. _`MicrosoftTeams`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/MicrosoftTeams/README.md .. _`Mobyt`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Mobyt/README.md .. _`Nexmo`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Nexmo/README.md .. _`Octopush`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Octopush/README.md @@ -939,11 +941,13 @@ is dispatched. Listeners receive a .. _`RocketChat`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/RocketChat/README.md .. _`Sendinblue`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sendinblue/README.md .. _`Sinch`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sinch/README.md +.. _`Slack`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Slack/README.md .. _`Sms77`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sms77/README.md .. _`Smsapi`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsapi/README.md .. _`SmsBiuras`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SmsBiuras/README.md .. _`Smsc`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsc/README.md .. _`SpotHit`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SpotHit/README.md +.. _`Telegram`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Telegram/README.md .. _`Telnyx`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Telnyx/README.md .. _`TurboSms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/TurboSms/README.md .. _`Twilio`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Twilio/README.md diff --git a/notifier/discord.rst b/notifier/discord.rst deleted file mode 100644 index d7315b73f3d..00000000000 --- a/notifier/discord.rst +++ /dev/null @@ -1,62 +0,0 @@ -.. index:: - single: Notifier; Chatters - -Discord Notifier -================ - -The Discord Notifier package allows to use Discord via the Symfony Notifier -component. Read the :doc:`main Notifier docs ` to learn about installing -and configuring that component. - -Adding Interactions to a Message --------------------------------- - -With a Discord message, you can use the -:class:`Symfony\\Component\\Notifier\\Bridge\\Discord\\DiscordOptions` class -to add some interactive options called `Embed elements`_:: - - use Symfony\Component\Notifier\Bridge\Discord\DiscordOptions; - use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordEmbed; - use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordFieldEmbedObject; - use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordFooterEmbedObject; - use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordMediaEmbedObject; - use Symfony\Component\Notifier\Message\ChatMessage; - - $chatMessage = new ChatMessage(''); - - // Create Discord Embed - $discordOptions = (new DiscordOptions()) - ->username('connor bot') - ->addEmbed((new DiscordEmbed()) - ->color(2021216) - ->title('New song added!') - ->thumbnail((new DiscordMediaEmbedObject()) - ->url('https://i.scdn.co/image/ab67616d0000b2735eb27502aa5cb1b4c9db426b')) - ->addField((new DiscordFieldEmbedObject()) - ->name('Track') - ->value('[Common Ground](https://open.spotify.com/track/36TYfGWUhIRlVjM8TxGUK6)') - ->inline(true) - ) - ->addField((new DiscordFieldEmbedObject()) - ->name('Artist') - ->value('Alasdair Fraser') - ->inline(true) - ) - ->addField((new DiscordFieldEmbedObject()) - ->name('Album') - ->value('Dawn Dance') - ->inline(true) - ) - ->footer((new DiscordFooterEmbedObject()) - ->text('Added ...') - ->iconUrl('https://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Spotify_logo_without_text.svg/200px-Spotify_logo_without_text.svg.png') - ) - ) - ; - - // Add the custom options to the chat message and send the message - $chatMessage->options($discordOptions); - - $chatter->send($chatMessage); - -.. _`Embed elements`: https://discord.com/developers/docs/resources/webhook diff --git a/notifier/slack.rst b/notifier/slack.rst deleted file mode 100644 index 8904ed6ad34..00000000000 --- a/notifier/slack.rst +++ /dev/null @@ -1,210 +0,0 @@ -.. index:: - single: Notifier; Chatters - -Slack Notifier -============== - -The Slack Notifier package allows to use Slack via the Symfony Notifier -component. Read the :doc:`main Notifier docs ` to learn about installing -and configuring that component. - -Adding Interactions to a Message --------------------------------- - -With a Slack message, you can use the -:class:`Symfony\\Component\\Notifier\\Bridge\\Slack\\SlackOptions` class -to add some interactive options called `Block elements`_:: - - use Symfony\Component\Notifier\Bridge\Slack\Block\SlackActionsBlock; - use Symfony\Component\Notifier\Bridge\Slack\Block\SlackDividerBlock; - use Symfony\Component\Notifier\Bridge\Slack\Block\SlackImageBlockElement; - use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock; - use Symfony\Component\Notifier\Bridge\Slack\SlackOptions; - use Symfony\Component\Notifier\Message\ChatMessage; - - $chatMessage = new ChatMessage('Contribute To Symfony'); - - // Create Slack Actions Block and add some buttons - $contributeToSymfonyBlocks = (new SlackActionsBlock()) - ->button( - 'Improve Documentation', - 'https://symfony.com/doc/current/contributing/documentation/standards.html', - 'primary' - ) - ->button( - 'Report bugs', - 'https://symfony.com/doc/current/contributing/code/bugs.html', - 'danger' - ); - - $slackOptions = (new SlackOptions()) - ->block((new SlackSectionBlock()) - ->text('The Symfony Community') - ->accessory( - new SlackImageBlockElement( - 'https://symfony.com/favicons/apple-touch-icon.png', - 'Symfony' - ) - ) - ) - ->block(new SlackDividerBlock()) - ->block($contributeToSymfonyBlocks); - - // Add the custom options to the chat message and send the message - $chatMessage->options($slackOptions); - - $chatter->send($chatMessage); - -Adding Fields and Values to a Message -------------------------------------- - -To add fields and values to your message you can use the -:method:`SlackSectionBlock::field() ` method:: - - use Symfony\Component\Notifier\Bridge\Slack\Block\SlackDividerBlock; - use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock; - use Symfony\Component\Notifier\Bridge\Slack\SlackOptions; - use Symfony\Component\Notifier\Message\ChatMessage; - - $chatMessage = new ChatMessage('Symfony Feature'); - - $options = (new SlackOptions()) - ->block((new SlackSectionBlock())->text('My message')) - ->block(new SlackDividerBlock()) - ->block( - (new SlackSectionBlock()) - ->field('*Max Rating*') - ->field('5.0') - ->field('*Min Rating*') - ->field('1.0') - ); - - // Add the custom options to the chat message and send the message - $chatMessage->options($options); - - $chatter->send($chatMessage); - -The result will be something like: - -.. image:: /_images/notifier/slack/field-method.png - :align: center - -.. versionadded:: 5.1 - - The `field()` method was introduced in Symfony 5.1. - -Adding a Header to a Message ----------------------------- - -To add a header to your message use the -:class:`Symfony\\Component\\Notifier\\Bridge\\Slack\\Block\\SlackHeaderBlock` class:: - - use Symfony\Component\Notifier\Bridge\Slack\Block\SlackDividerBlock; - use Symfony\Component\Notifier\Bridge\Slack\Block\SlackHeaderBlock; - use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock; - use Symfony\Component\Notifier\Bridge\Slack\SlackOptions; - use Symfony\Component\Notifier\Message\ChatMessage; - - $chatMessage = new ChatMessage('Symfony Feature'); - - $options = (new SlackOptions()) - ->block((new SlackHeaderBlock('My Header'))) - ->block((new SlackSectionBlock())->text('My message')) - ->block(new SlackDividerBlock()) - ->block( - (new SlackSectionBlock()) - ->field('*Max Rating*') - ->field('5.0') - ->field('*Min Rating*') - ->field('1.0') - ); - - // Add the custom options to the chat message and send the message - $chatMessage->options($options); - - $chatter->send($chatMessage); - -The result will be something like: - -.. image:: /_images/notifier/slack/slack-header.png - :align: center - -.. versionadded:: 5.3 - - The ``SlackHeaderBlock`` class was introduced in Symfony 5.3. - -Adding a Footer to a Message ----------------------------- - -To add a footer to your message use the -:class:`Symfony\\Component\\Notifier\\Bridge\\Slack\\Block\\SlackContextBlock` class:: - - use Symfony\Component\Notifier\Bridge\Slack\Block\SlackContextBlock; - use Symfony\Component\Notifier\Bridge\Slack\Block\SlackDividerBlock; - use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock; - use Symfony\Component\Notifier\Bridge\Slack\SlackOptions; - use Symfony\Component\Notifier\Message\ChatMessage; - - $chatMessage = new ChatMessage('Symfony Feature'); - - $contextBlock = (new SlackContextBlock()) - ->text('My Context') - ->image('https://symfony.com/logos/symfony_white_03.png', 'Symfony Logo') - ; - - $options = (new SlackOptions()) - ->block((new SlackSectionBlock())->text('My message')) - ->block(new SlackDividerBlock()) - ->block( - (new SlackSectionBlock()) - ->field('*Max Rating*') - ->field('5.0') - ->field('*Min Rating*') - ->field('1.0') - ) - ->block($contextBlock) - ; - - $chatter->send($chatMessage); - -The result will be something like: - -.. image:: /_images/notifier/slack/slack-footer.png - :align: center - -.. versionadded:: 5.3 - - The ``SlackContextBlock`` class was introduced in Symfony 5.3. - -Sending a Message as a Reply ----------------------------- - -To send your slack message as a reply in a thread use the -:method:`SlackOptions::threadTs() ` method:: - - use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock; - use Symfony\Component\Notifier\Bridge\Slack\SlackOptions; - use Symfony\Component\Notifier\Message\ChatMessage; - - $chatMessage = new ChatMessage('Symfony Feature'); - - $options = (new SlackOptions()) - ->block((new SlackSectionBlock())->text('My reply')) - ->threadTs('1621592155.003100') - ; - - // Add the custom options to the chat message and send the message - $chatMessage->options($options); - - $chatter->send($chatMessage); - -The result will be something like: - -.. image:: /_images/notifier/slack/message-reply.png - :align: center - -.. versionadded:: 5.3 - - The ``threadTs()`` method was introduced in Symfony 5.3. - -.. _`Block elements`: https://api.slack.com/reference/block-kit/block-elements diff --git a/notifier/teams.rst b/notifier/teams.rst deleted file mode 100644 index b638bfdcc16..00000000000 --- a/notifier/teams.rst +++ /dev/null @@ -1,103 +0,0 @@ -.. index:: - single: Notifier; Chatters - -Microsoft Teams Notifier -======================== - -The Microsoft Teams Notifier package allows to use Microsoft Teams via the Symfony -Notifier component. Read the :doc:`main Notifier docs ` to learn about -installing and configuring that component. - -Adding text to a Message ------------------------- - -With a Microsoft Teams, you can use the ChatMessage class:: - - use Symfony\Component\Notifier\Bridge\MicrosoftTeams\MicrosoftTeamsTransport; - use Symfony\Component\Notifier\Message\ChatMessage; - - $chatMessage = (new ChatMessage('Contribute To Symfony'))->transport('microsoftteams'); - $chatter->send($chatMessage); - -The result will be something like: - -.. image:: /_images/notifier/microsoft_teams/message.png - :align: center - -Adding Interactions to a Message --------------------------------- - -With a Microsoft Teams Message, you can use the -:class:`Symfony\\Component\\Notifier\\Bridge\\MicrosoftTeams\\MicrosoftTeamsOptions` class -to add `MessageCard options`_:: - - use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Action\ActionCard; - use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Action\HttpPostAction; - use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Action\Input\DateInput; - use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Action\Input\TextInput; - use Symfony\Component\Notifier\Bridge\MicrosoftTeams\MicrosoftTeamsOptions; - use Symfony\Component\Notifier\Bridge\MicrosoftTeams\MicrosoftTeamsTransport; - use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Section\Field\Fact; - use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Section\Section; - use Symfony\Component\Notifier\Message\ChatMessage; - - $chatMessage = new ChatMessage(''); - - // Action elements - $input = new TextInput(); - $input->id('input_title'); - $input->isMultiline(true)->maxLength(5)->title('In a few words, why would you like to participate?'); - - $inputDate = new DateInput(); - $inputDate->title('Proposed date')->id('input_date'); - - // Create Microsoft Teams MessageCard - $microsoftTeamsOptions = (new MicrosoftTeamsOptions()) - ->title('Symfony Online Meeting') - ->text('Symfony Online Meeting are the events where the best developers meet to share experiences...') - ->summary('Summary') - ->themeColor('#F4D35E') - ->section((new Section()) - ->title('Talk about Symfony 5.3 - would you like to join? Please give a shout!') - ->fact((new Fact()) - ->name('Presenter') - ->value('Fabien Potencier') - ) - ->fact((new Fact()) - ->name('Speaker') - ->value('Patricia Smith') - ) - ->fact((new Fact()) - ->name('Duration') - ->value('90 min') - ) - ->fact((new Fact()) - ->name('Date') - ->value('TBA') - ) - ) - ->action((new ActionCard()) - ->name('ActionCard') - ->input($input) - ->input($inputDate) - ->action((new HttpPostAction()) - ->name('Add comment') - ->target('http://target') - ) - ) - ; - - // Add the custom options to the chat message and send the message - $chatMessage->options($microsoftTeamsOptions); - $chatter->send($chatMessage); - -The result will be something like: - -.. image:: /_images/notifier/microsoft_teams/message-card.png - :align: center - -.. versionadded:: 5.4 - - Options for Microsoft Teams were introduced in Symfony 5.4. - -.. _`MessageCard options`: https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference diff --git a/notifier/telegram.rst b/notifier/telegram.rst deleted file mode 100644 index 0ce6854b7f2..00000000000 --- a/notifier/telegram.rst +++ /dev/null @@ -1,43 +0,0 @@ -.. index:: - single: Notifier; Chatters - -Telegram Notifier -================= - -The Telegram Notifier package allows to use Telegram via the Symfony Notifier -component. Read the :doc:`main Notifier docs ` to learn about installing -and configuring that component. - -Adding Interactions to a Message --------------------------------- - -With a Telegram message, you can use the -:class:`Symfony\\Component\\Notifier\\Bridge\\Telegram\\TelegramOptions` class -to add `message options`_:: - - use Symfony\Component\Notifier\Bridge\Telegram\Reply\Markup\Button\InlineKeyboardButton; - use Symfony\Component\Notifier\Bridge\Telegram\Reply\Markup\InlineKeyboardMarkup; - use Symfony\Component\Notifier\Bridge\Telegram\TelegramOptions; - use Symfony\Component\Notifier\Message\ChatMessage; - - $chatMessage = new ChatMessage(''); - - // Create Telegram options - $telegramOptions = (new TelegramOptions()) - ->chatId('@symfonynotifierdev') - ->parseMode('MarkdownV2') - ->disableWebPagePreview(true) - ->disableNotification(true) - ->replyMarkup((new InlineKeyboardMarkup()) - ->inlineKeyboard([ - (new InlineKeyboardButton('Visit symfony.com')) - ->url('https://symfony.com/'), - ]) - ); - - // Add the custom options to the chat message and send the message - $chatMessage->options($telegramOptions); - - $chatter->send($chatMessage); - -.. _`message options`: https://core.telegram.org/bots/api