You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This package makes it easy to send notifications using [Microsoft Teams](https://products.office.com/en-US/microsoft-teams/group-chat-software) with Laravel 5.5+, 6.x, 7.x, 8.x, 9.x, 10.x, 11.x and 12.x
@@ -52,7 +75,7 @@ Next, if you're using Laravel _without_ auto-discovery, add the service provider
52
75
53
76
### Setting up the Connector
54
77
55
-
Please check out [this](https://docs.microsoft.com/en-gb/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook#add-an-incoming-webhook-to-a-teams-channel) for setting up and adding a webhook connector to your Team's channel. Basic Markdown is supported, please also check out the [message card reference article](https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#httppost-action) which goes in more detail about the do's and don'ts.
78
+
Please check out [this](https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498) for setting up and adding a webhook connector to your Team's channel. Please also check out the [adaptive card reference](https://learn.microsoft.com/en-us/adaptive-cards/) which goes in more detail about adaptive cards.
56
79
57
80
### Setting up the MicrosoftTeams service
58
81
@@ -98,12 +121,33 @@ class SubscriptionCreated extends Notification
|`summary(string $summary)`| Summary of the message |
137
-
|`type(string $type)`| Type which is used as theme color (any valid hex code or one of: primary|secondary|accent|error|info|success|warning) |
138
-
|`content(string $content)`| Content of the message (Markdown supported) |
139
-
|`button(string $text, string $url = '', array $params = [])`| Text and url of a button. Wrapper for an potential action |
140
-
|`action(string $text, $type = 'OpenUri', array $params = [])`| Text and type for a potential action. Further params can be added depending on the action. For more infos about different types check out [this link](https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#actions). |
141
-
|`options(array $options, $sectionId = null)`| Add additional options to pass to the message payload object |
142
-
143
-
#### Sections
144
-
It is possible to define one or many sections inside a message card. The following methods can be used within a section
145
-
|**Method**|**Description**|
146
-
|------------|-----------------|
147
-
|`addStartGroupToSection($sectionId = 'standard_section')`| Add a startGroup property which marks the start of a logical group of information |
148
-
|`activity(string $activityImage = '', string $activityTitle = '', string $activitySubtitle = '', string $activityText = '', $sectionId = 'standard_section')`| Add an activity to a section |
149
-
|`fact(string $name, string $value, $sectionId = 'standard_section')`| Add a fact to a section (Supports Markdown) |
150
-
|`image(string $imageUri, string $title = '', $sectionId = 'standard_section')`| Add an image to a section |
151
-
|`heroImage(string $imageUri, string $title = '', $sectionId = 'standard_section')`| Add a hero image to a section |
152
-
153
-
Additionally the title, content, button and action can be also added to a section through the optional `params` value:
154
-
|**Method**|**Description**|
155
-
|------------|-----------------|
156
-
|`title(string $title, array $params = ['section' => 'my-section'])`| Title of the message and add it to `my-section`|
157
-
|`content(string $content, array $params = ['section' => 'my-section'])`| Content of the message and add it to `my-section` (Markdown supported) |
158
-
|`button(string $text, string $url = '', array $params = ['section' => 'my-section'])`| Text and url of a button and add it to `my-section`|
159
-
|`action(string $text, $type = 'OpenUri', array $params = ['section' => 'my-section'])`| Text and type of an potential action and add it to `my-section`|
176
+
-`create()`: Static factory method to create a new instance of the MicrosoftTeamsAdaptiveCard.
177
+
-`to(string $webhookUrl)`: Sets the recipient's webhook URL. Required for sending notifications.
178
+
-`title(string $title)`: Sets the title of the adaptive card with appropriate text styling (heading style, bold weight, and large size).
179
+
-`content(array $contentBlocks)`: Adds content blocks to the adaptive card body. Accepts an array of content block objects like TextBlock, FactSet, Icon, etc.
180
+
-`actions(array $actions)`: Adds action buttons to the adaptive card. Accepts an array of action objects like ActionOpenUrl.
181
+
-`getWebhookUrl()`: Returns the currently set webhook URL.
182
+
-`toNotGiven()`: Checks if the webhook URL has been provided. Returns true if no webhook URL is set.
183
+
-`toArray()`: Returns the complete payload as an associative array.
184
+
185
+
### Content Block Types
186
+
You can use various content block types in the content() method:
187
+
188
+
#### `TextBlock::create()`: Creates a text block with options for:
189
+
190
+
-`setText(string $text)`: Sets the text content (supports markdown formatting)
191
+
-`setFontType(string $fontType)`: Sets the font type (e.g., 'Default', 'Monospace')
192
+
-`setWeight(string $weight)`: Sets text weight (e.g., 'Lighter', 'Default', 'Bolder')
Microsoft is deprecating **O365 Connectors** within Microsoft Teams, which means **Message Cards** are now considered legacy and will no longer be supported. As a result, this package has been updated to use **Adaptive Cards** instead.
7
+
8
+
With this major update, you will need to:
9
+
#### Outside Your Application
10
+
-**Create new incoming webhooks using Workflows for Microsoft Teams** (O365 Connectors are no longer valid).
11
+
12
+
#### Inside Your Application
13
+
-**Migrate from Message Cards to Adaptive Cards** for Teams notifications.
14
+
-**Adjust your message formatting** (Adaptive Cards use structured blocks instead of Markdown).
15
+
16
+
### Breaking Changes
17
+
-**Message Cards are no longer supported**
18
+
-**O365 Connectors cannot be used**; users must create new webhooks with Workflows
19
+
-**Adaptive Cards require structured content blocks** instead of Markdown formatting
20
+
21
+
### Upgrade Steps
22
+
23
+
#### 1. Create a New Webhook
24
+
Since O365 Connectors are being deprecated, you must create a new incoming webhook using Microsoft Teams Workflows:
25
+
26
+
[Official Microsoft Guide](https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498)
27
+
28
+
Once created, update your `.env` file with the new webhook URL:
0 commit comments