There are several ways to add one ore more attachments to a message public function toRocketChat( $notifiable) '□')Īvatar(): This will make the avatar use the provided image url.Īttachment(): This will add an single attachment.Īttachments(): This will add multiple attachments.ĬlearAttachments(): This will remove all attachments. Supports Github flavoured markdown.Īlias(): This will cause the message’s name to appear as the given alias, but your username will still display.Įmoji(): This will make the avatar on this message be an emoji. To(): Specifies the channel id to send the notification to (overridden by routeNotificationForRocketChat if empty).Ĭontent(): Sets a content of the notification message. In order to let your notification know which RocketChat channel you are targeting, add the routeNotificationForRocketChat method to your Notifiable model: public function routeNotificationForRocketChat(): string > from( 'webhook_token') // optional if set in config > to( 'channel_name') // optional if set in config Return RocketChatMessage:: create( 'Test message') Public function toRocketChat( $notifiable): RocketChatMessage Use NotificationChannels\ RocketChat\ RocketChatWebhookChannel Use NotificationChannels\ RocketChat\ RocketChatMessage You can use the channel in your via() method inside the notification: use Illuminate\ Notifications\ Notification Default channel (optional) 'channel' => env( 'ROCKETCHAT_CHANNEL'), Base URL for RocketChat API server () 'url' => env( 'ROCKETCHAT_URL'), In order to send message to RocketChat channels, you need to obtain Webhook.Īdd your RocketChat API server's base url, incoming Webhook Token and optionally the default channel to your config/services.php: // config/services.php. You can install the package via composer: $ composer require laravel-notification-channels/rocket-chat Setting up the RocketChat service This package makes it easy to send notifications using RocketChat with Laravel 5.6+.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |