我有一个功能正常的通知系统,可以发布到我们公司 Slack 的频道。但是,遇到的一切都只是文本。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; }}这是一个已知问题,版本不匹配,还是我遗漏了什么?
1 回答

料青山看我应如是
TA贡献1772条经验 获得超8个赞
https://api.slack.com/reference/surfaces/formatting#mentioning-users
要在应用发布的文本中提及用户,您需要按以下语法提供他们的用户 ID:
Hey <@U024BE7LH>, thanks for submitting your report.
- 1 回答
- 0 关注
- 115 浏览
添加回答
举报
0/150
提交
取消