Download the PHP package agencelex/notifications-microsoft-teams without Composer
On this page you can find all versions of the php package agencelex/notifications-microsoft-teams. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download agencelex/notifications-microsoft-teams
More information about agencelex/notifications-microsoft-teams
Files in agencelex/notifications-microsoft-teams
Package notifications-microsoft-teams
Short Description A Microsoft Teams notification channel provider for the Laravel-style notification system (agencelex/notifications). Enables sending real-time alerts, structured data, and rich adaptive cards directly to Microsoft Teams channels from any notifiable object.
License GPL-2.0-or-later
Homepage https://github.com/agencelex/typo3-notifications-microsoft-teams
Informations about the package notifications-microsoft-teams
lex_notifications_microsoft_teams
Microsoft Teams channel provider for lex_notifications. Send rich Adaptive Cards to any Teams channel from any TYPO3 extension, scheduler task, middleware, or domain service — using the same Laravel-inspired notification API you already know.
Table of Contents
- Requirements
- Installation
- Setting Up a Teams Webhook
- Quick Start
- Core Concepts
- CanSendToTeams — on the Notification class
- HasRouteNotificationForTeams — on the notifiable model
- Routing the Webhook URL
- Building Adaptive Cards
- AdaptiveCard
- TextBlock
- FactSet & Fact
- Image & ImageSet
- Container
- ColumnSet & Column
- RichTextBlock
- ActionSet
- Actions
- Real-World Examples
- Order Confirmation
- Server Alert
- New User Registration with Avatar
- Content Approval Request
- Multi-Channel Notification (Teams + Mail)
- References
Requirements
| Requirement | Version |
|---|---|
| PHP | ^8.2 |
| TYPO3 | ^13.4 \|\| ^14.3 |
| agencelex/notifications | ^1.3 |
Installation
Activate the extension in the TYPO3 Extension Manager or via composer (Composer-mode installations activate it automatically).
Setting Up a Teams Webhook
This extension sends messages via the Teams Workflows webhook (the modern replacement for the deprecated Office 365 Connectors).
- Open the Teams channel you want to post to.
- Click … → Workflows.
- Search for "Post to a channel when a webhook request is received" and select it.
- Follow the wizard — give it a name and click Next.
- Copy the generated webhook URL (it looks like
https://prod.webhook.office.com/webhookb2/…).
Official guide: Create an Incoming Webhook — Microsoft Learn
Quick Start
Send it from anywhere:
Core Concepts
This extension provides two independent traits. Each addresses a different side of the notification contract.
CanSendToTeams — on the Notification class
Add this trait to any class that extends Lex\Notifications\Notification to declare that it can be sent to Teams. The trait enforces a single contract: the class must implement toTeams(object $notifiable): TeamsMessage.
TeamsChannel checks for the presence of toTeams() at runtime and throws an \InvalidArgumentException (code 1789350405) if the notification was dispatched to the teams channel without implementing it.
HasRouteNotificationForTeams — on the notifiable model
Add this trait to the notifiable model (e.g. a FrontendUser, a BackendUser, or any domain entity using the Notifiable trait) to declare that it can provide a Teams webhook URL. The trait enforces that the class implements routeNotificationForTeams(): string.
Routing the Webhook URL
The channel resolves the webhook URL in this order — the first non-empty value wins:
| Priority | Source | How |
|---|---|---|
| 1 (highest) | TeamsMessage::webhookUrl() |
Call ->webhookUrl('https://…') when building the message |
| 2 | Notifiable model | Implement routeNotificationForTeams(): string (via HasRouteNotificationForTeams) |
Option A — Per-message (highest priority)
Useful when the URL differs per notification, or when the notifiable has no concept of a webhook URL:
Option B — On the notifiable model (recommended for most cases)
The channel automatically calls routeNotificationForTeams() when no URL is set on the message:
Building Adaptive Cards
Adaptive Cards are JSON documents that Teams renders natively. Use the fluent PHP builders below — no JSON authoring required.
Interactive designer: Adaptive Cards Designer Full schema reference: Adaptive Cards Schema Explorer Teams-specific guidance: Adaptive Cards in Teams — Microsoft Learn
AdaptiveCard
The root container for all card content.
TextBlock
Displays plain or formatted text. wrap(true) is enabled by default.
FactSet & Fact
Renders a two-column key/value table — ideal for structured metadata.
Image & ImageSet
Container
Groups elements with shared styling or a background.
ColumnSet & Column
Divides content into side-by-side columns.
Column width accepts:
"auto"— shrinks to fit content"stretch"— fills remaining space"50px"— explicit pixel width"1","2", … — proportional weight
RichTextBlock
Inline-styled text in a single paragraph. Mix weights, colours, and sizes without separate TextBlock elements.
ActionSet
Embeds action buttons at a specific position in the body (rather than always at the bottom).
Actions
All actions accept common properties: ->id(), ->style(), ->iconUrl(), ->tooltip(), ->isEnabled(), ->mode().
Action\OpenUrl — open a URL
Action\Submit — submit form data
Action\ShowCard — reveal an inline card
Action\ToggleVisibility — show/hide elements
Real-World Examples
Order Confirmation
Notifies the fulfilment team when a new order is placed.
The notifiable (e.g. the fulfilment channel entity) provides the webhook URL:
Server Alert
Sends a critical alert with severity colour coding when a monitor threshold is exceeded.
New User Registration with Avatar
Posts a profile card with a person-style avatar when a new frontend user registers.
Content Approval Request
Sent to the editorial team when an editor submits a page for review. Uses ToggleVisibility to reveal the full editorial note on demand.
Multi-Channel Notification (Teams + Mail)
Both traits can be composed freely. Include teams alongside any other channel in via().
References
| Resource | Link |
|---|---|
| Set up a Teams Incoming Webhook | Microsoft Learn — Incoming Webhooks |
| Adaptive Card schema explorer | adaptivecards.io/explorer |
| Adaptive Cards interactive designer | adaptivecards.io/designer |
| Adaptive Cards in Microsoft Teams | Microsoft Learn — Cards reference |
| Teams Workflows (Power Automate) | Microsoft Learn — Power Automate & Teams |
| Message card object reference | Microsoft Learn — Message card reference |
| lex_notifications (core) | GitHub — agencelex/typo3-notifications |