symfony/notifier with Microsoft Teams #49066
{{editor}}'s edit
{{editor}}'s edit
-
Hello, I try to use the official notifier with Microsoft Teams : https://symfony.com/doc/current/notifier.html this is my "notifier.yaml" : (i don't found a sample with Teams) framework:
notifier:
chatter_transports:
microsoftteams: '%env(DSN_TEAMS)%' and my Controller for test : <?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Notifier\Notification\Notification;
use Symfony\Component\Notifier\NotifierInterface;
use Symfony\Component\Notifier\Recipient\NoRecipient;
class DashboardController extends AbstractController
{
#[Route('/dashboard', name: 'app_dashboard')]
public function index(NotifierInterface $notifier): Response
{
$notification = (new Notification('Test Cyril', ['microsoftteams']))
->content('Test Chatter In Channel');
$recipient = new NoRecipient();
$notifier->send($notification, $recipient);
return $this->render('dashboard.html.twig', [
'controller_name' => 'DashboardController',
]);
}
} and this is the result : I can't find a solution for that, any idea ? And of cours i have installed the good package : "symfony/microsoft-teams-notifier": "6.2.*",
"symfony/notifier": "6.2.*", thanks ! |
Beta Was this translation helpful? Give feedback.
Replies: 1 suggested answer 1 reply
-
Hello, it seems you’re confusing channels with transports. Here, $notification = (new Notification('Test Cyril', ['chat']))
->content('Test Chatter In Channel'); Note that if you know you’ll always use this transport you can use the |
Beta Was this translation helpful? Give feedback.
Hello,
it seems you’re confusing channels with transports. Here,
symfony/microsoft-teams-notifier
provides a transport for thechat
channel, so your notification should beNote that if you know you’ll always use this transport you can use the
Chatter
rather than theNotifier
: https://symfony.com/doc/current/notifier/teams.html