[WordPress] 外掛分享: Rock The Slackbot

WordPress 外掛 Rock The Slackbot 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Rock The Slackbot」是 2015-11-02 上架。
  • 目前有 100 個安裝啟用數。
  • 上一次更新是 2017-01-10,距離現在已有 3036 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.0 以上版本才可以安裝。
  • 有 15 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

bamadesigner |

外掛標籤

chat | slack | slackbot | notification | collaboration |

內容簡介

Slack 是什麼?

Slack 是一個團隊協作工具,提供按主題整理的聊天室,還有私人群組和直接訊息。這是一個很好的方法,可以讓你在不堵塞收件匣的情況下與團隊保持高效率。

Slackbot 是什麼?

Slackbot 是 Slack 的內建機器人,可協助我們在 Slack 帳戶內向您和您的團隊發送訊息。

為什麼使用 Rock the Slackbot?

因為它可以幫助您管理您的網站,並通過將通知(以下 WordPress 事件的多項)發送到您的 Slackbot,使您保持最新狀態,Rock the Slackbot 可以將其傳送到您的 Slack 帳戶中的頻道或直接訊息中。

Rock the Slackbot 支援多站點。

Rock the Slackbot 為以下事件發送可自訂通知:

當發布文章時
當取消發布文章時
當更新文章時
當刪除文章時
當垃圾桶中的文章被刪除時
當新增留言時
當留言已核准時
當留言未經核准時
當留言被標記為垃圾留言時
當留言被移到垃圾桶時
當 404 錯誤發生時
當刪除選單項目時
當新增媒體時
當編輯媒體時
當刪除媒體時
當新增使用者時
當刪除使用者時
當使用者角色更改時
當插件、佈景主題或核心更新可用時
當插件、佈景主題或核心更新時

我們正在努力增加以下事件:

選單項目新增時
上傳插件或佈景主題時
啟用插件或佈景主題時

您可以自訂每個事件,以允許您將不同事件通知發送到不同的 Slack 頻道,例如,您可以將核心、佈景主題和插件更新發送到您的 "wp-development" 頻道,而所有文章更改都發送到您的 "wp-content" 頻道。

請使用此外掛的 GitHub 存儲庫之 Issues 部分來建議像其他通知事件等功能。

必須使用 Slack 帳戶才能使用此外掛程式,並且可以免費使用並且沒有限制的時間和人數拜訪 Slack 網站以了解更多資訊並註冊。

發送簡單的 Slack 訊息

您可使用以下的 send_webhook_message() 函數將簡單的訊息發送到您的 Slack 帳戶。

此函數接受以下參數:

$webhook_id_or_url - 提供 web hook 網址或在設定中存儲的 ID。
$message - 您想要傳送的訊息

$channel - 選擇性 - 您想要發送訊息的頻道。利用 # 加上頻道名稱或 @ 加上特定使用者即可,如果沒有傳送任何訊息,將使用預設頻道。

// 使用此函數將簡單的訊息傳送到 Slack

rock_the_slackbot()->send_webhook_message( '564d3c1cdf52d', 'this is a test', '#testchannel' );

過濾器

Rock the Slackbot 已設置過濾器,允許您在WordPress 通知發送之前進行微調。 您可以為所有通知設置篩選器,也可以按事件或特定 webhook 進行分析。

每個通知篩選器都可自訂,讓您將不同的 WordPress 事件通知發送到不同的 Slack 頻道或直接訊息。 例如,您可以將核心、佈景主題和插件更新發送到您的 "wp-development" 頻道,而所有文章更改都發送到您的 "wp-content" 頻道。

原文外掛簡介

What is Slack?
Slack is a team collaboration tool that offers chat rooms organized by topic, as well as private groups and direct messaging. It’s a great way to be productive with your team without clogging up your inbox.
What is A Slackbot?
Slackbot is Slack’s built-in robot, which helps us send messages to you and your team inside your Slack account.
Why Rock The Slackbot?
Because it can help you manage your websites, and stay on top of changes, by sending notifications (following numerous WordPress events) to your Slackbot who will pass them along to a channel or direct message in your Slack account.
Rock the Slackbot is multisite-friendly.
Rock the Slackbot sends customizable notifications for the following events:

When a post is published
When a post is unpublished
When a post is updated
When a post is deleted
When a post is trashed
When a comment is added
When a comment is approved
When a comment is unapproved
When a comment is marked as spam
When a comment is trashed
When a 404 error is thrown
When a menu item is deleted
When media is added
When media is edited
When media is deleted
When a user is added
When a user is deleted
When a user’s role is changed
When a plugin, theme, or core update is available
When a plugin, theme, or core is updated

I’m working to add the following events:

When menu item is added
When plugins or themes are uploaded
When plugins or themes are activated

Each event can be customized to allow you to send different event notifications to different Slack channels, e.g. you can send core, theme and plugin updates to your “wp-development” channel while all of your post changes go to your “wp-content” channel.
Please use the Issues section of this plugin’s GitHub repo to suggest features, like other notification events.
A Slack account is required to use this plugin and is free to use for as long as you want and with an unlimited number of people. Visit the Slack website to learn more and sign up.
Send A Simple Slack Message
You can use the following send_webhook_message() function to send a simple message to your Slack account.
The function accepts the following parameters:

$webhook_id_or_url – provide the webhook URL or the ID of one stored in settings
$message – the message you want to send

$channel – OPTIONAL – the channel you want to send message to. Prefix with # for a specific channel or @ for a specific user. Will use default channel if nothing is passed.
// Use this function to send a simple message to Slack
rock_the_slackbot()->send_webhook_message( ‘564d3c1cdf52d’, ‘this is a test’, ‘#testchannel’ );
Filters
Rock The Slackbot has filters setup to allow you to tweak each WordPress notification before it’s sent. You can setup a filter for all notifications or drill down by event or specific webhook.

Each notification filter passes three arguments:

$notification – an array containing the notification information: webhook URL (the URL for your Slack account) and the payload (all of the information being sent to Slack) for the notification
$notification_event – the slug of the notification event

Will be false if you send a custom Slack notification that doesn’t involve a WordPress event

$event_args – an array containing notification event specific information

Will be false if you send a custom Slack notification that doesn’t involve a WordPress event

See Notification Events below to learn which information is passed to the filters for each notification event.
Filter all WordPress notifications
add_filter( 'rock_the_slackbot_notification', 'filter_rock_the_slackbot_notification', 10, 3 );
function filter_rock_the_slackbot_notification( $notification, $notification_event, $event_args ) {

// Change the pieces

// Return the notification
return $notification;
}

Filter WordPress notifications by webhook ID
// You can find the ID for each of your webhooks on their edit screen in the admin
add_filter( 'rock_the_slackbot_notification_(webhook_id)', 'filter_rock_the_slackbot_notification_webhook', 10, 3 );
function filter_rock_the_slackbot_notification_webhook( $notification, $notification_event, $event_args ) {

// Change the pieces

// Return the notification
return $notification;
}

Filter WordPress notifications by event slug
// The event slugs are listed below
add_filter( 'rock_the_slackbot_notification_(notification_event)', 'filter_rock_the_slackbot_notification_event', 10, 3 );
function filter_rock_the_slackbot_notification_event( $notification, $notification_event, $event_args ) {

// Change the pieces

// Return the notification
return $notification;
}

Filter all outgoing webhook payloads that are sent to Slack
Whether it’s a WordPress notification or a simple Slack message, all messages to Slack are sent as a payload in an outgoing webhook. This filter allows you to change any payload sent to Slack in an outgoing webhook.
add_filter( 'rock_the_slackbot_outgoing_webhook_payload', 'filter_rock_the_slackbot_outgoing_webhook_payload', 10, 2 );
function filter_rock_the_slackbot_outgoing_webhook_payload( $payload, $webhook_url ) {

// Change the payload

// Return the payload
return $notification;
}

Notification Events

Including event specific information passed to filters for each notification event.
Content

post_published

Passed To Filters

post – the WP_Post object data of the post that was published
old_post_status – the status of the post before it was published
new_post_status – the current status of the published post

post_unpublished

Passed To Filters

post – the WP_Post object data of the post that was unpublished
old_post_status – the status of the post before it was unpublished
new_post_status – the current status of the unpublished post

post_updated

Passed To Filters

post_id – the post ID of the post you updated
post_before – the WP_Post object data of the post before it was updated
post_after – the WP_Post object data of the post after it was updated

post_deleted

Passed To Filters

post – the WP_Post object data of the post that was deleted

post_trashed

Passed To Filters

post – the WP_Post object data of the post that was trashed

is_404

Passed To Filters

url – the URL that threw the 404 error
referer – the HTTP referer (may not always be defined)
ip_address – the IP address of the user who visited the URL (may not always be defined)
user_agent – the user agent of the user who visited the URL (may not always be defined)
wp_query – the WordPress query variables
mysql_request – the MySQL query request

Menus

menu_item_deleted

Passed To Filters

menu – the WP_Post object data of the menu that held the menu item
menu_item_id – the post ID of the menu item that was deleted

Media

add_attachment

Passed To Filters

attachment_post – the WP_Post object data for the attachment you added

edit_attachment

Passed To Filters

attachment_post – the WP_Post object data for the attachment you edited

delete_attachment

Passed To Filters

attachment_post – the WP_Post object data for the attachment you deleted

Users

user_added

Passed To Filters

user – the WP_User data for the user you added

user_deleted

Passed To Filters

user – the WP_User data for the user you deleted

set_user_role

Passed To Filters

user – the WP_User data for the user whose role was changed
current_user_roles – the current user roles for the user whose role was changed
old_user_roles – the old user roles for the user whose role was changed

Updates

core_update_available

Passed To Filters

current_version – the current version number of WordPress core
new_version – the version number for the WordPress core update

core_updated

Passed To Filters

current_version – the current version number of WordPress core after the update
old_version – the old version number for WordPress core before the update

plugin_update_available

Passed To Filters

plugins – includes an array of the plugins who have updates available

plugin_updated

Passed To Filters

plugin – includes an array of the plugin(s) that were updated

theme_update_available

Passed To Filters

themes – includes an array of the themes who have updates available

theme_updated

Passed To Filters

theme – includes an array of the theme(s) that were updated

Filter Examples
You can use a filter to change the Slack notification to go to a different Slack channel according to post information, like the post category:
add_filter( 'rock_the_slackbot_notification', 'filter_rock_the_slackbot_notification', 10, 3 );
function filter_rock_the_slackbot_notification( $notification, $notification_event, $event_args ) {

// Only run filter for specific events
switch ( $notification_event ) {

// This way you can set which events you want to use
case 'post_published':
case 'post_unpublished':
case 'post_updated':
case 'post_deleted':
case 'post_trashed':

// Get category names
$categories = wp_get_post_categories( $event_args[ 'post_id' ], array( 'fields' => 'names' ) );

// Replace 'CategoryName' with the category you're looking for
if ( in_array( 'CategoryName', $categories ) ) {

// Change the channel in the payload
// Make sure you prefix the channel name with #
$notification[ 'payload' ][ 'channel' ] = '#newchannel';

}
break;
}

// Return the notification
return $notification;
}

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Rock The Slackbot」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0.0 | 1.1.0 | 1.1.1 | 1.1.2 | trunk |

延伸相關外掛(你可能也想知道)

  • Joinchat 》🎉透過訪客喜愛的聊天應用程式與您的網站訪客聊天。在您的網站底部放置浮動按鈕,為您的客戶提供最好的支援。, , 這是全球安裝量超過 40 萬的最佳 WhatsApp W...。
  • Floating Chat Widget: Contact Chat Icons, Telegram Chat, Line Messenger, WeChat, Email, SMS, Call Button, WhatsApp – Chaty 》主要功能:, , 透過各大訊息應用程式,例如 WhatsApp 聊天、Facebook Messenger 等,與訪客進行互動聊天來增加潛在客戶及來電數量。並在網站底部顯示聊天按鈕...。
  • Tidio – Live Chat & AI Chatbots 》若你正在尋找一款易於使用的WordPress網站現場聊天外掛,Tidio恰好提供這項功能及更多功能。 它是一個多功能的客戶服務平台,能夠提供世界一流的客戶支援並積...。
  • Facebook Chat Plugin – Live Chat Plugin for WordPress 》在您的網站上使用 Messenger 聊天與客戶溝通。Chat Plugin 是由 Meta Business 維護的聊天小工具,可在您的網站上提供即時聊天。, 網站訪客不論使用電腦或手...。
  • Simple Chat Button 》Simple Chat Button 是一個快速(不使用 JavaScript)、輕量級且非常簡單的 WordPress 外掛,可在 WordPress 前端顯示漂亮的 WhatsApp 固定按鈕。, 點擊 What...。
  • Brevo for WooCommerce 》Sendinblue的WooCommerce外掛是將您的商店整合並發送更好的通訊的最簡單方式。, , 受到全球400,000家企業的信賴,Sendinblue是一個全能的行銷平台,通過有針...。
  • Chatway Live Chat – Customer Support, FAQ & Helpdesk Customer Service, Chat Buttons, and WhatsApp 》- 使用Chatway - 即時聊天應用程式,您可以通過WordPress網站與訪問者進行即時聊天以及更多互動。, - Chatway是一個輕量級、易於使用的即時聊天應用程式,以...。
  • Word Balloon 》Word Balloon 外掛可以輕鬆在文章中加入漫畫對話框。, 有各種各樣的對話框可以選擇使用,此外還可以添加效果、過濾器、圖示和聲音。, 支援區塊編輯器(Gutenb...。
  • AI Power: Complete AI Pack 》GPT AI Power 是一個完整的 WordPress 人工智慧套件,可以生成具有自訂選項的內容、圖像和表單。它包括 AI 訓練、聊天小工具、WooCommerce 整合、Embeddings ...。
  • Drift 》Drift 是一種最簡單的方式,免費將即時聊天客服功能新增到您的網站上。, , 98%的網站訪客在訪問您的網站後無所作為就離開了!現在是改變這種情況的時候了。,...。
  • Cresta Help Chat 》外掛展示 | 外掛網站, 使用 Cresta Help Chat,您可以讓用戶或客戶通過單擊按鈕與您聯繫 WhatsApp。用戶可以直接在 WhatsApp 聯繫您的私人消息,並在 WhatsAp...。
  • Better Messages – Live Chat for WordPress, BuddyPress, PeepSo, Ultimate Member, BuddyBoss 》「Better Messages」是一款適用於 WordPress、BuddyPress、BuddyBoss 平台、Ultimate Member 和 PeepSo 等其他 WordPress 網站的即時私人訊息系統外掛程式。...。
  • Chat Widget: Customer Support Button with SMS Call Button, Click to Chat Messenger, Live Chat Support Chat Button – Bit Assist 》Bit Assist 將您的網站訪客轉化成潛在客戶, ♻ 這個外掛如何運作?, 使用訪客最喜歡的 Facebook Messenger、WhatsApp、Tawk to、Telegram、Viber、Slack 等來...。
  • AI Chatbot for WordPress – Hyve Lite 》總結:Hyve Lite 是一個AI驅動的WordPress外掛程式,將您的網站內容轉換為互動對話。它利用您的文章和頁面作為知識庫,實現動態用戶互動。輕鬆從WordPress儀...。
  • Wise Chat 》Wise Chat 是一款領先的聊天外掛程式,可幫助建立社交網絡,進而提高網站使用者的參與度。該外掛提供聊天室發送即時訊息的平台。聊天室易於安裝和配置,每個...。

文章
Filter
Apply Filters
Mastodon