Skip to content

Commit d6c6ce2

Browse files
committed
feat: Remove deprecated code and adapt documentation regarding the upgrade
1 parent 1003ec7 commit d6c6ce2

File tree

5 files changed

+16
-19
lines changed

5 files changed

+16
-19
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
All notable changes to `microsoft-teams` will be documented in this file
44

5-
Adaptive Cards
5+
## 2.0.0
6+
7+
- Transition to Microsoft Adaptive Cards
8+
- Set min supported PHP version to >=8.1
9+
- Remove deprecated code
610

711
## 1.1.4 - 2023-01-25
812

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66

77
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
88

9+
**Since v2 we transitioned from traditional message cards to [MS Adaptive Cards](https://adaptivecards.io). In case you need to upgrade please check out our [Migration Guide](/UPGRADE.md).**
10+
911
```php
1012
return MicrosoftTeamsAdaptiveCard::create()
1113
->to(config('services.microsoft_teams.webhook_url'))
1214
->title('Subscription Created')
1315
->content([
1416
TextBlock::create()
15-
->setText('Yey, you got a **new subscription**. Maybe you want to contact him if he needs any support?')
17+
->setText('Yey, you got a **new subscription**.')
1618
->setFontType('Monospace')
1719
->setWeight('Bolder')
1820
->setSize('ExtraLarge')
@@ -32,7 +34,7 @@ return MicrosoftTeamsAdaptiveCard::create()
3234
->setMode('Primary')
3335
->setStyle('Positive')
3436
->setTitle('Contact Customer')
35-
->setUrl("https://foo.bar"),
37+
->setUrl("https://www.tournamize.com"),
3638
]);
3739
```
3840

@@ -126,7 +128,7 @@ class SubscriptionCreated extends Notification
126128
->title('Subscription Created')
127129
->content([
128130
TextBlock::create()
129-
->setText('Yey, you got a **new subscription**. Maybe you want to contact him if he needs any support?')
131+
->setText('Yey, you got a **new subscription**.')
130132
->setFontType('Monospace')
131133
->setWeight('Bolder')
132134
->setSize('ExtraLarge')
@@ -146,7 +148,7 @@ class SubscriptionCreated extends Notification
146148
->setMode('Primary')
147149
->setStyle('Positive')
148150
->setTitle('Contact Customer')
149-
->setUrl("https://foo.bar"),
151+
->setUrl("https://www.tournamize.com"),
150152
]);
151153
}
152154
}

UPGRADE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ Since O365 Connectors are being deprecated, you must create a new incoming webho
3434
Once created, update your `.env` file with the new webhook URL:
3535

3636
```env
37-
MICROSOFT_TEAMS_NOTIFICATION_WEBHOOK_URL=https://your-new-webhook-url
37+
TEAMS_WEBHOOK_URL=https://your-new-webhook-url
3838
```
3939

4040
Update `config/services.php` to reference the new webhook:
4141

4242
```php
4343
'microsoft_teams' => [
44-
'notification_webhook_url' => env('MICROSOFT_TEAMS_NOTIFICATION_WEBHOOK_URL'),
44+
'webhook_url' => env('TEAMS_WEBHOOK_URL'),
4545
]
4646
```
4747

@@ -54,7 +54,7 @@ return MicrosoftTeamsMessage::create()
5454
->to(config('services.microsoft_teams.notification_webhook_url'))
5555
->type('success')
5656
->title('Subscription Created')
57-
->content('Yey, you got a **new subscription**. Maybe you want to contact him if he needs any support?')
57+
->content('Yey, you got a **new subscription**.')
5858
->button('Check User', 'https://foo.bar/users/123');
5959
```
6060

@@ -66,7 +66,7 @@ return MicrosoftTeamsAdaptiveCard::create()
6666
->title('Subscription Created')
6767
->content([
6868
TextBlock::create()
69-
->setText('Yey, you got a **new subscription**. Maybe you want to contact him if he needs any support?')
69+
->setText('Yey, you got a **new subscription**.')
7070
->setWeight('Bolder')
7171
->setSize('Large'),
7272
])

src/MicrosoftTeams.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ public function send(string $url, array $data): ?ResponseInterface
4040
if (! $url) {
4141
throw CouldNotSendNotification::microsoftTeamsWebhookUrlMissing();
4242
}
43-
// convert associative array to numeric array in sections (since ms is otherwise not acception the body structure)
44-
if (isset($data['sections'])) {
45-
$data['sections'] = array_values($data['sections']);
46-
}
43+
4744
try {
4845
$response = $this->httpClient->post($url, [
4946
'json' => $data,

src/MicrosoftTeamsServiceProvider.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ public function boot()
3030
*/
3131
public function register()
3232
{
33-
// Info: Name 'teams' is deprecated an will be removed with the next major release
34-
// Please use 'microsoftTeams' for all calls
35-
Notification::extend('teams', static function (Container $app) {
36-
return $app->make(MicrosoftTeamsChannel::class);
37-
});
38-
3933
Notification::extend('microsoftTeams', static function (Container $app) {
4034
return $app->make(MicrosoftTeamsChannel::class);
4135
});

0 commit comments

Comments
 (0)