您如何使用laravel松弛通知API在松弛的人(@)?

问题描述 投票:0回答:1

我有一个可以正常运行的通知系统,可以将其发布到我们公司Slack的Channel中。但是,碰到的一切仅仅是文本。假设linkNames在您的内容中查找/链接用户名。我看到它设置为“ 1”,但是当它出现在通道中时没有任何影响。

 namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\SlackMessage;
class Dd extends Notification
{
use Queueable;

/**
 * Create a new notification instance.
 *
 * @return void
 */
public function __construct()
{
    //
}

/**
 * Get the notification's delivery channels.
 *
 * @param  mixed  $notifiable
 * @return array
 */
public function via($notifiable)
{
    return ['slack'];
}


/**
 * Get the array representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return array
 */
public function toArray($notifiable)
{
    return [
        //
    ];
}

/**
 * Get the Slack representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return SlackMessage
 */
public function toSlack($slackComment)
{   
    $slackMessage = new SlackMessage();
    $slackMessage->linkNames();
    $slackMessage->from('Christopher');
    $slackMessage->to($slackComment->channel);
    $slackMessage->content("Harded coded for example @christopher <- this doesn't get linked to the user in slack but should");
     $slackMessage->info();
    //dd($slackMessage); // this shows that the linkedNames attribute has been set to "1"
    return $slackMessage;             
}

}

How it shows up in Slack

这是已知问题,版本不匹配还是我缺少某些内容?

php laravel-5.6 slack-api
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.