我有一個(gè)功能正常的通知系統(tǒng),可以發(fā)布到我們公司 Slack 的頻道。但是,遇到的一切都只是文本。linkNames假設(shè)在您的內(nèi)容中查找/鏈接用戶名。我看到它被設(shè)置為“1”,但當(dāng)它出現(xiàn)在頻道中時(shí)沒有影響。 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; }}這是一個(gè)已知問題,版本不匹配,還是我遺漏了什么?
1 回答
料青山看我應(yīng)如是
TA貢獻(xiàn)1772條經(jīng)驗(yàn) 獲得超8個(gè)贊
https://api.slack.com/reference/surfaces/formatting#mentioning-users
要在應(yīng)用發(fā)布的文本中提及用戶,您需要按以下語法提供他們的用戶 ID:
Hey <@U024BE7LH>, thanks for submitting your report.
- 1 回答
- 0 關(guān)注
- 140 瀏覽
添加回答
舉報(bào)
0/150
提交
取消
