$settings = [
'username' => Auth::user()->name,
'icon' => 'http://iosicongallery.com/img/512/slack-2014.png',
'link_names' => true
];
$client = new \Maknz\Slack\Client('https://hooks.slack.com/services/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',$settings);
$userslack = $client->attach([
'fallback' => 'Fallback',
'callback_id'=> 'game',
'color' => 'danger',
'attachment_type' => 'default',
'fields' => [
[
'title' => 'From Date',
'value' => $fr_date,
'short' => true
],
[
'title' => 'To Date',
'value' => $to_date,
'short' => true
],
[
'title' => 'Reason',
'value' => $leave->description,
'short' => true
]
],
'actions' => [
[
'name' => 'leave',
'text' => 'Approved',
'style' => 'default',
'type' => 'button',
'value' => 'approve',
'confirm' => [
'title' => 'title1',
'text' => 'Your Leave Requested has been Approved',
'ok_text' => 'Yes',
'dismiss_text' => 'No',
],
],
[
'name' => 'leave',
'text' => 'Cancel',
'style' => 'default',
'type' => 'button',
'value' => 'cancel',
'confirm' => [
'title' => 'Title 2',
'text' => 'Your leave request is cancelled',
'ok_text' => 'No',
'dismiss_text' => 'No',
],
],
],
])->send('Ofman Leave and Permission');
我需要在我的Slack应用程序中完全输出交互式消息,就像这个交互式消息示例截图
一样https://a.slack-edge.com/dcb1/img/api/message_guidelines/Example_6.gif
提前致谢