laravel-notification-channels / microsoft-teams Goto Github PK
View Code? Open in Web Editor NEWMicrosoft Teams Notifications Channel for Laravel
Home Page: https://laravel-notification-channels.com
License: MIT License
Microsoft Teams Notifications Channel for Laravel
Home Page: https://laravel-notification-channels.com
License: MIT License
Laravel 8 has been released today and we need to update this repo to support it.
See https://laravel.com/docs/8.x/upgrade & laravel-notification-channels/channels#107
There is inconsistency in the naming. This should be consistent as either teams or microsoftTeams. For compatibility, registering as both might make sense along with a deprecation notice for whichever you remove in the future?
vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php:94
Hi, I've just been browsing the Microsoft Teams notification channel. In my web application, users have the option to intgrate Microsoft Teams to receive notifications, by design, each user in my system needs their own webhook URL, but the assumption of this channel is that only one Microsoft Teams account will be set up and used as the config doesn't seem to mention anything about pulling from the DB.
How can I obtain the user's webhook URL that they desire in my User
model?
Can we send notification to user on teams chat by any chance?
Great package btw and Kudos for job
Trying to set it up so it sends me a message when a new user is created. But I keep getting and no reason as to why. Was hoping someone else has seen this before.
Microsoft Teams responded with an error 405 - Client error:
POST https://teams.microsoft.com/l/channel/19%3ab078bb283c3843ec89b3849330d32773%40thread.skype/TestChat?groupId=a0dfa142-c15d-46d0-b400-071d26173017&tenantId=df2dd858-6005-4352-b666-dd038f050723` resulted in a 405 Method Not Allowed
response`
Hi,
thanks for your great package, it has worked flawlessly for 2 years in my company.
But I think it would be great to add a timeout option for requests, something in config files which would be 0 by default but can be configured for a timeout.
Context :
There were some problems with incoming teams webhooks this monday and tuesday (with absolutely no communication from microsoft about the issue by the way) which resulted in a disruption of our ticketing system (which sends notifcations to teams) at my company.
random 500 and 503 errors which we can catch and log, without any disruption of service, but the webhook would sometimes not respond at all, which resulted in a 504 error for our customers.
I had to fork the project in a private package and add this functionnality, since this was critical for us and I could'nt wait for an approval of a PR, but let me know if you're interested so I can make it a little cleaner and propose a PR.
How do I mention users in the content/title of a message?
I tried doing:
@my Name
@my_email
@microsoft_user_id
<at>My Name</at>
<at>my_email</at>
<at>microsoft_user_id</at>
return MicrosoftTeamsMessage::create()
->to(config('services.microsoft_teams.webhook_url'))
->type($contents[1])
->title($contents[0])
->content($contents[0], [
[
'entities' => [
[
'type' => 'mention',
'text' => '<at>' . $this->users[0]->getFullName() . '</at>',
'mentioned' => [
'id' => $this->users[0]->email,
'name' => $this->users[0]->getFullName()
]
],
[
'type' => 'mention',
'text' => '<at>' . $this->users[0]->email . '</at>',
'mentioned' => [
'id' => {microsoft_user_id}',
'name' => $this->users[0]->getFullName()
]
]
]
]
])
But I just can't seem to get a proper mention.
On line 38 of MicrosoftTeamsChannel, you're calling
$to = $notifiable->routeNotificationFor('microsoftTeams');
However, routeNotificationFor should have a 2nd argument which is the $notification object. This SHOULD be changed to
$to = $notifiable->routeNotificationFor('microsoftTeams', $notification);
Can you please upgrade the GuzzleHttp dependency to version 7 as l have some packages that requires that version.
Hi, thanks for the work on the package, is there a way to. use this package with on demand? https://laravel.com/docs/8.x/notifications#on-demand-notifications
Also, Can I use this:
public function via($notifiable)
{
return ['mail','slack','teams'];
}
Appreciate any help, thanks
I have tried all the possible options to add an image, but it never shows:
$teams->image('https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Seattle_monorail01_2008-02-25.jpg/1024px-Seattle_monorail01_2008-02-25.jpg');
$teams->heroImage('https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Seattle_monorail01_2008-02-25.jpg/1024px-Seattle_monorail01_2008-02-25.jpg');
$teams->options([
// "@type" => "application/vnd.microsoft.card.thumbnail",
"title" => "title",
"subtitle" => "subtitle",
"text" => "text",
"image" => "https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Seattle_monorail01_2008-02-25.jpg/1024px-Seattle_monorail01_2008-02-25.jpg",
"images" => ["url" => "https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Seattle_monorail01_2008-02-25.jpg/1024px-Seattle_monorail01_2008-02-25.jpg" ]
]);
I tried with all @types in https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-reference: Thumbnail, Cards, Heros, ...
Also this is the further I get:
$teams->options([
"sections" => [
[
"images" => [
[
"image" => $image
]
]
]
]
]);
This generates this JSON payload (I took it exactly before it sends to Microsoft)
$response = $this->microsoftTeams->send($message->getWebhookUrl(), $message->toArray());
{
"@type": "MessageCard",
"@context": "https:\/\/schema.org\/extensions",
"summary": "summary",
"themeColor": "#1976D2",
"text": "text",
"title": "title",
"sections": [
{
"images": [
{
"image": "http://connectorsdemo.azurewebsites.net/images/WIN12_Anthony_02.jpg"
}
]
}
]
}
And this works PERFECTLY in https://messagecardplayground.azurewebsites.net/
But not through this module.
Any way to really add an image ?
The only thing I got is an avatar (little circle image), but it's not a big image ;-)
I've tried with gif, jpg, png, ... even the image of the Microsoft documentation (the monorail :-) )
Hello, I would like to send an online message after a task, is it possible? Could you give me an example?
Note: I have not been able to send without creating a Controller, that's why my query.
Thank you
Example code
$channel = new MicrosoftTeamsChannel(config('services.microsoft_teams.DTES_url'));
$teamsMessage= MicrosoftTeamsMessage::create()
->type('warning')
->title('Cliente No Encontrado')
->content('Test<br><br>');
$response = $channel->send(null, **$teamsMessage);**
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.