
內容目錄
內容簡介
推送 Telegram 消息通知:
* 當在 WooCommerce 收到新訂單時。
* 當 WooCommerce 訂單更改狀態時。
* 在 WooCommerce 結帳頁面上新增一個字段,讓客戶添加自己的 Telegram 呢稱。
* 在產品庫存條件不足時發出庫存不足產品通知。
* 在管理員訂單詳細資料頁面顯示 Telegram 呢稱連結(當存在時)。
* 當收到新表單時(支援 WPForm、CF7 和 Ninjaform)。
* 當新用戶訂閱或取消訂閱 Mailchimp 時。
* 當新用戶註冊時。
* 當用戶登錄失敗時。
* 當有人將產品添加到 WooCommerce 購物車中時。
* 當收到新未發布文章時(適用於任何文章類型)。
* 語音功能,可讓機器人向人們發出語音訊息。
* Cron 作業檢測並通知插件和核心更新時。
* 在 WordPress 的任何地方使用簡碼發送自訂訊息。
* 應該在多站點上運作。
您可以在外掛設置頁面啟用/停用每個通知。
要配置該插件,您需要一個有效的 Telegram API 令牌。輕鬆地開始創建 Telegram 機器人即可獲取其令牌。
您可以在此文件
中了解有關獲取令牌和生成新令牌的知識,或按此處中的信息操作。
您還需要至少一個“chatid”號碼,該號碼是消息接收者。要知道您的個人聊天 ID 號碼,請在 Telegram 應用程序中搜索“@get_id_bot”或按此處OR另一個機器人單擊此處。
完成上述兩步驟後,保存配置並嘗試使用“TEST”按鈕。您應該會在 Telegram 中收到一條消息:“哇,它運作了!” 如果沒有,再次檢查令牌和 chatid 項是否填寫正確。
此插件依賴於第三方服務來獲取 IP 地址https://ip-api.com/的地理位置。
https://ip-api.com/docs/legal以查看該服務的使用條款和/或隱私政策
簡碼示例
[telegram_mess message="我太高興了" chatids="0000000," token="000000000:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" showsitename="1" showip="1" showcity="1" ]
簡碼選項:
message:您要發送的訊息。例如(message=”hello world”)
chatids:以逗號分隔的接收者,他們將收到您的訊息(例如 chatids=”0000000,11111111″)。如果為空,簡碼將在外掛選項頁面中使用預設值。
token:令牌看起來像123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
如果為空,簡碼將在外掛選項頁面中使用預設值。
showsitename:如果設置為“1”,則在訊息之後添加網站名稱。預設值為“0”。例如(showsitename=”1″)
showip:如果設置為“1”,則在訊息之後添加用戶 IP 地址。默認值為“0”。例如(showip=”1″)
showcity:如果設置為“1”,則在訊息之後添加用戶城市名稱。預設值為“0”。例如(showcity=”1″)
使用簡碼
外掛標籤
開發者團隊
原文外掛簡介
The “Notification for Telegram” plugin for WordPress is a tool that allows you to send notifications and messages to a Telegram channel, group or user/s when specific events occur on your WordPress site.
This plugin is useful for monitoring critical events on your site, such as new comments, new user registrations, publishing activities, New forms sent,Woocommerce and Surecart orders, cart and lowstock, Mailchimp and more, by sending notifications directly to a Telegram channel or group or user/s of your choice. It also offers a shortcode to send Telegram notifications on every page of your website or in your code.
Receive Telegram messages notification when:
When receive a new order in Woocommerce.
When a Woocommerce order change status.
When receive a new order in Surecart.
Every event captured by WP Activity Log plugin
New field in Woocommerce checkout page let customers add the own telegram nickname
Low Stock Product notifications when a product is low stock conditions.
Shows Telegram Nick link in admin order details page when present
When receive new forms (supports Elementor Pro Form, WPForm , CF7 and Ninjaform)
When new user subscribes or unsubscribes to mailchimp. MC4WP integration
When new user registers. Helps identify unauthorized or suspicious registrations.
When users login or fail login.
When new comment is posted.
When someone adds or remove a product in the Woocommerce cart.
When a new Pending posts is received. (works with any post type)
Say function to speak to make the bot say Something to the people
Cron job detect and notify when Plugins & Core need to update.
Send custom message with Shortcode anywhere in your WP.
Should Work on Multisite
You can enable/disable every notification in the Plugin settings page.
To configure the plugin, you need a valid Telegram API token. Its easy to get starting a Telegram Bot.
You can learn about obtaining tokens and generating new ones in
Setup Guide
A complete step-by-step guide is available here:
View the full documentation
To get your Bot Token, you can refer to one of these resources:
Official Telegram documentation
Step-by-step guide on Medium
To get your Chat ID, you need at least one recipient ID. You can retrieve it using one of these bots directly in Telegram:
@get_id_bot — send /start and it will reply with your personal Chat ID
@RawDataBot — send any message and it will return your full account info including your ID
For Channel and Group Chatid settings see the FAQ section.
Once You got the 2 fields save the configuration and try the “TEST” button .. you should receive a message in you telegram : “WOW IT WORKS” !! If not, check token and chatid fields again for the correct values.
this plugin is relying on a 3rd party service to geolocate the Ip address https://ip-api.com/
https://ip-api.com/docs/legal to see the services’ a terms of use and/or privacy policies
AI & MCP Compatible
This plugin supports the WordPress Abilities API and is compatible with
MCP (Model Context Protocol) — the standard that allows AI agents like
Claude, ChatGPT, and others to interact with WordPress autonomously.
If the Abilities API and MCP Adapter plugins are installed, any
authorized AI agent can automatically discover and use the
Send Telegram Message ability — no extra configuration needed.
What an AI can do with this plugin:
* Send a Telegram message with custom text
* Add an inline button with label and URL
* Override the default chat ID
Requirements for MCP
WordPress 6.9+
Plugin: Abilities API (WordPress/abilities-api)
Plugin: MCP Adapter (WordPress/mcp-adapter)
MESSAGES TRANSLATION
To translate Telegram messages, use WPML or Loco Translate. All notification strings are now translatable.
Go to Loco Translate → Plugins → Notification for Telegram to add your translations.
For WPML, ensure String Translation is enabled to modify notification texts.
SHORTCODE EXAMPLE
[telegram_mess message="Im so happy" chatids="0000000," token="000000000:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" showsitename="1" showip="1" showcity="1" ]
SHORTCODE OPTIONS:
message : Your message to be sent. Example (message=”hello world”)
chatids : Recipient(s) who will receive your message separated by comma (example chatids=”0000000,11111111″) , If not present this field the shortcode will use default value in Plugin option page.
token: The token looks something like 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
If not present this field, the shortcode will use default value in Plugin option page.
showsitename: if set to “1” appends sitename after the message. Defaultvalue is “0” Example (showsitename=”1″)
showip: if set to “1” appends user ip address after the message. Default value is “0” Example (showip=”1″)
showcity: if set to “1” appends user city name after the message. Default value is “0” Example (showcity=”1″)
USE SHORTCODE IN YOU PHP CODE
WOOCOMMERCE FILTER HOOKS
We have created 4 filter hooks for WooCommerce order notification message. 4 new positions: Message Header, Message Footer, before Items, and after Items. And we have created a filter through which you can add custom code to product rows, and if you want, you can replace and customize the entire row. :
4 new Positions and code axample ( echo payment_status in the 4 positions)
get_data();
// Extract specific order information
$payment_status = $order->get_status();
$payment_method = $order->get_payment_method();
}
return "\r\n\r\n".$payment_method."(".$payment_status.")\r\n" ;
}
?>
Product rows Filter with 2 different behaviors ADD or REPLACE LINE
".$product_id. "\r\n";
// REPLACE Product ITEM LINE CODE WITH YOUR CODE without concatenate $message.
$modified_data = $product_id. "\r\n";
return $modified_data;
}
?>
USER LOGIN FILTER HOOKS
user_registered;
$timestamp = strtotime( $registration_date );
$formatter = new IntlDateFormatter( 'en_US', IntlDateFormatter::LONG, IntlDateFormatter::LONG, 'UTC' );
$formatter->setPattern( 'd MMMM y HH:mm:ss' );
$formatted_date = $formatter->format( $timestamp );
$message = "\r\n\r\nUser Registration Date: " . $formatted_date . "\r\n\r\n";
} else {
$message = "\r\nNo info available for this user.\r\n";
}
return $message;
}
?>
LEGACY FUNCTIONS (kept for backward compatibility)
Before hooks were introduced, 3 overridable functions allowed message customization without editing plugin code. These are still supported but we encourage migrating to hooks.
1) Before the product list — example: prepend the Order ID
2) After the product list — example: append the order currency
get_data();
return "Currency: " . $data['currency'];
}
?>
3) At the end of each product line — example: append the product slug
get_slug() . " ";
}
?>
Suggestions for new notifications, hooks, and plugin integrations are always welcome!
