File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -643,7 +643,7 @@ and its ``asChatMessage()`` method::
643
643
use Symfony\Component\Notifier\Message\ChatMessage;
644
644
use Symfony\Component\Notifier\Notification\ChatNotificationInterface;
645
645
use Symfony\Component\Notifier\Notification\Notification;
646
- use Symfony\Component\Notifier\Recipient\SmsRecipientInterface ;
646
+ use Symfony\Component\Notifier\Recipient\RecipientInterface ;
647
647
648
648
class InvoiceNotification extends Notification implements ChatNotificationInterface
649
649
{
@@ -656,10 +656,11 @@ and its ``asChatMessage()`` method::
656
656
657
657
public function asChatMessage(RecipientInterface $recipient, string $transport = null): ?ChatMessage
658
658
{
659
- // Add a custom emoji if the message is sent to Slack
659
+ // Add a custom subject and emoji if the message is sent to Slack
660
660
if ('slack' === $transport) {
661
- return (new ChatMessage('You\'re invoiced '.$this->price.' EUR.'))
662
- ->emoji('money');
661
+ $this->subject('You\'re invoiced '.strval($this->price).' EUR.');
662
+ $this->emoji("money");
663
+ return ChatMessage::fromNotification($this);
663
664
}
664
665
665
666
// If you return null, the Notifier will create the ChatMessage
You can’t perform that action at this time.
0 commit comments