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.