最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to create a custom channel on Symfony Notifier? - Stack Overflow

programmeradmin5浏览0评论

I'm working on a project with Symfony 7.2 that uses the Notifier component. I'm making use of the SMS and Email channels, but need to also send messages via phone (automated voice) calls. I currently use Twilio for this.

I'm struggling to find a concrete example of how to create and register the new channel voice_call.

I've created a class as follows:

<?php
namespace App\Notifier\Channel\VoiceCallMessage;

#[AsAlias('notifier.channel.voice_call')]
#[AutoconfigureTag('notifier.channel', ['channel' => 'voice_call'])]
final class VoiceCallChannel implements ChannelInterface
{
    // Stuff here
}

I then try to create a notification as follows:

$notification = (new Notification('New Test notification', ['voice_call']))
    ->content('This is all working.')
;

This gives the error:

[ERROR] Message not sent: The "voice_call" channel is not supported.

发布评论

评论列表(0)

  1. 暂无评论