內容簡介
*將 WordPress 的自動通知發送至您的 Slack / Mattermost 應用頻道和 Webhooks 中。
您可以以任何方式整合此外掛,不受限制。
它支持所有其他 Vanilla Bean 外掛,並且可用於「在幕後」使用和短代碼存取。
一些短代碼範例:
[slackhooker text="這是一則 WordPress 的訊息"]
或者
[slackhooker text="這是一則訊息" channel="general" username="我的 WordPress"]
或者
[slackhooker text="這是一則訊息" channel="https://myorg.slack.com/services/xxoxlsodsfsfsdfds#channelname" username="我的 WordPress"]
訊息將排入 PHP 處理序的最後以確保不會中斷其他網頁處理,但您可以覆寫:
[slackhooker text="這是一則WordPress訊息。" sendnow="true"]
支援多個或自訂 Webhooks
[slackhooker text="這是一則訊息,發佈至多個 Webhooks" alsoto="https://hooks.slack.com/services/T03TDTbUF/BBG9SQV6X/abcdefghij,https://hooks.slack.com/services/T03TDTbUF/BBG9SQV6X/abcxxxxxxx"]
程式化範例
if(function_exists('\VanillaBeans\SlackHooker\vbean_slackhooker')){
\VanillaBeans\SlackHooker\vbean_slackhooker('這是我的通知');
}
if(function_exists('\VanillaBeans\SlackHooker\vbean_slackhooker')){
\VanillaBeans\SlackHooker\vbean_slackhooker('這是我的通知','mychannel','使用者名稱',':特定圖示:');
}
if(function_exists('\VanillaBeans\SlackHooker\vbean_slackhooker')){
\VanillaBeans\SlackHooker\vbean_slacknotify(array('text'=>'這是我的通知', 'icon'=>':open_mouth:'));
}
除了訊息之外,每個參數都有預設值。您可以指定:
`* text – 為必要參數,這是您的訊息
* endpoints – 使用以逗點分隔的 endpooints 清單覆寫預設值,可指定頻道和警報,例如:endpoints=’https://endpoint.com#channel#here”
* channel – 預設為「general」或您的管理員預設頻道 - 已棄用
* username – 顯示於頻道中的寄件者身份
* icon – Slack 系統中任何可用的表情符號
* sendnow – true 或 false,預設為 false。True 表示當收到呼叫時立即執行訊息,而不是在頁面載入結束時。
聯繫方式
我們可以在以下位置找到:
* (http://www.velvary.com.au/contact-us)
* Twitter:@VelvaryVanilla
* 電子郵件:info@ 或 support@ velvary.com.au
外掛標籤
開發者團隊
原文外掛簡介
Automated notifications from your WordPress site to your Slack / Mattermost application channels and webhooks.
There is no limit to the ways you may integrate this plugin.
It supports all other Vanilla Bean plugins and is available for under-the-hood use as well as shortcode access.
Key Features
Real-time WordPress notifications – Post status changes, comments, user registrations
WooCommerce integration – Sales notifications with order details
Plugin management alerts – Install, update, and deletion notifications
Multiple webhook support – Send to Slack, Mattermost, Discord, or custom endpoints
Formatted data messages – Rich attachments with structured name-value pairs (NEW in 5.5.2)
Smart queueing – Non-blocking message delivery with optional immediate sending
Email fallback – Send notifications via email when webhooks aren’t available
Shortcode support – Easy integration in posts and pages
Programmatic API – Full developer access with PHP functions
Shortcode Examples
[slackhooker text="Here is a message from my WordPress site"]
or
[slackhooker text="Here is a message" channel="general" username="My WordPress"]
or
[slackhooker text="Here is a message" channel="https://myorg.slack.com/services/xxoxlsodsfsfsdfds#channelname" username="My WordPress"]
Messages are queued last in the PHP process to ensure your other page processing is not interrupted, but you can override:
[slackhooker text="Here is a message from my WordPress." sendnow="true"]
Multiple or custom webhooks supported:
[slackhooker text="Here is a message to multiple webhooks" alsoto="https://hooks.slack.com/services/T03TDTbUF/BBG9SQV6X/abcdefghij,https://hooks.slack.com/services/T03TDTbUF/BBG9SQV6X/abcxxxxxxx"]
Programmatic Examples
Simple text messages:
if(function_exists('\VanillaBeans\SlackHooker\vbean_slackhooker')){
\VanillaBeans\SlackHooker\vbean_slackhooker('Here is my notification');
}
if(function_exists('\VanillaBeans\SlackHooker\vbean_slackhooker')){
\VanillaBeans\SlackHooker\vbean_slackhooker('Here is my notification','mychannel','Username',':specific_icon:');
}
if(function_exists('\VanillaBeans\SlackHooker\vbean_slacknotify')){
\VanillaBeans\SlackHooker\vbean_slacknotify(array('text'=>'Here is my notification','icon'=>':open_mouth:'));
}
Formatted data messages (NEW in 5.5.2):
if(function_exists('\VanillaBeans\SlackHooker\vbean_send_data')){
$data = array(
'User ID' => '12345',
'Email' => '[email protected]',
'Status' => 'Active',
'Last Login' => '2025-10-03 14:30:00'
);
\VanillaBeans\SlackHooker\vbean_send_data('User Registration', $data);
}
Custom formatted messages with options:
if(function_exists('\VanillaBeans\SlackHooker\vbean_send_data')){
$data = array(
'Order ID' => '#WC-12345',
'Amount' => '$299.99',
'Customer' => 'John Doe',
'Payment Method' => 'Credit Card'
);
$options = array(
'color' => '#00ff00',
'pretext' => 'New WooCommerce Sale!',
'text' => 'Payment processed successfully'
);
\VanillaBeans\SlackHooker\vbean_send_data('E-commerce Sale', $data, $options);
}
Building custom attachment messages:
if(function_exists('\VanillaBeans\SlackHooker\vbean_build_data_message')){
$message = \VanillaBeans\SlackHooker\vbean_build_data_message('System Alert', array(
'Server' => 'web-01.example.com',
'CPU Usage' => '85%',
'Memory' => '3.2GB / 4GB',
'Disk Space' => '75% full'
), array('color' => '#ff9900'));
// Send using existing notification system
Vanilla_Bean_Slack_Hooker::notification_send($message);
}
Parameters
There are defaults for all except the message. You can specify:
text – required. This is your message
endpoints – override defaults with a comma separated list of endpoints with optional channel and alert eg: endpoints=’https://endpoint.com#channel#here’
channel – defaults to ‘general’ or your admin default specified channel – deprecated
username – the identity you would like displayed as the sender in the channel
icon – any of the available emoji icons in the slack system
sendnow – true or false. Defaults to false. True means that the message would be executed at the time it is called rather than at the end of page load.
New Data Message Parameters (5.5.2):
title – required for data messages. Main title of the message
data – associative array of name => value pairs to display
options – array of formatting options (color, pretext, text, author_name, etc.)
Use Cases
E-commerce monitoring – WooCommerce order notifications
User activity tracking – Registration and login alerts
System monitoring – Server status and health checks
Content management – Post publication and comment notifications
Security alerts – Failed login attempts and suspicious activity
Plugin management – Installation, update, and deletion notifications
Contact
We can be found at:
Website: Velvary Contact
Twitter: @VelvaryVanilla
Email: [email protected] or [email protected]
