symfony / microsoft-teams-notifier
Symfony Microsoft Teams Notifier Bridge
Fund package maintenance!
fabpot
Tidelift
symfony.com/sponsor
Installs: 427 041
Dependents: 2
Suggesters: 0
Security: 0
Stars: 8
Watchers: 4
Forks: 3
Type:symfony-notifier-bridge
Requires
- php: >=8.2
- symfony/http-client: ^6.4|^7.0
- symfony/notifier: ^7.2
- 7.2.x-dev
- v7.2.0-RC1
- v7.2.0-BETA1
- 7.1.x-dev
- v7.1.6
- v7.1.1
- v7.1.0
- v7.1.0-RC1
- v7.1.0-BETA1
- 7.0.x-dev
- v7.0.8
- v7.0.7
- v7.0.3
- v7.0.0
- v7.0.0-RC1
- v7.0.0-BETA1
- 6.4.x-dev
- v6.4.13
- v6.4.8
- v6.4.7
- v6.4.3
- v6.4.0
- v6.4.0-RC1
- v6.4.0-BETA1
- 6.3.x-dev
- v6.3.12
- v6.3.0
- v6.3.0-RC1
- v6.3.0-BETA1
- 6.2.x-dev
- v6.2.8
- v6.2.7
- v6.2.5
- v6.2.0
- v6.2.0-RC1
- v6.2.0-BETA1
- 6.1.x-dev
- v6.1.11
- v6.1.3
- v6.1.0
- v6.1.0-RC1
- v6.1.0-BETA1
- 6.0.x-dev
- v6.0.19
- v6.0.11
- v6.0.8
- v6.0.5
- v6.0.3
- v6.0.0
- v6.0.0-RC1
- v6.0.0-BETA2
- v6.0.0-BETA1
- 5.4.x-dev
- v5.4.45
- v5.4.40
- v5.4.39
- v5.4.35
- v5.4.31
- v5.4.22
- v5.4.21
- v5.4.19
- v5.4.11
- v5.4.8
- v5.4.5
- v5.4.3
- v5.4.0
- v5.4.0-RC1
- v5.4.0-BETA2
- v5.4.0-BETA1
- 5.3.x-dev
- v5.3.14
- v5.3.4
- v5.3.0
- v5.3.0-RC1
- v5.3.0-BETA1
This package is auto-updated.
Last update: 2024-11-13 15:17:00 UTC
README
Provides Microsoft Teams integration through Incoming Webhook for Symfony Notifier.
DSN example
MICROSOFT_TEAMS_DSN=microsoftteams://default/PATH
where:
PATH
has the following format:webhookb2/{uuid}@{uuid}/IncomingWebhook/{id}/{uuid}
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);
Adding Interactions to a Message
With a Microsoft Teams Message, you can use the 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);