Telegram is one of the most steadily growing messenger app. It is incredibly fast, powerful, and can be totally private. It has an open API which allows anyone to hookup their own apps with Telegram. In this article, we will show you how to integrate your WordPress site with Telegram.
Telegram是最稳定增长的Messenger应用程序之一。 它非常快,功能强大,并且可以完全私有。 它具有开放的API,任何人都可以使用Telegram连接自己的应用程序。 在本文中,我们将向您展示如何将WordPress网站与Telegram集成。
![Integrate WordPress with Telegram messenger app Integrate WordPress with Telegram messenger app](https://i-blog.csdnimg.cn/blog_migrate/47bd4e1b5ffcfb2653f66f9308e06f3d.png)
什么是电报? (What is Telegram?)
Telegram is a cloud based messaging app. Think of it as WhatsApp, just more open, secure, safe, and private.
Telegram是一个基于云的消息传递应用程序。 将其视为WhatsApp ,只是更加开放,安全,安全和私有。
Telegram allows you to communicate with your contacts. All messages sent by Telegram are encrypted can be easily deleted or self-destruct.
电报使您可以与联系人通信。 Telegram发送的所有消息都是加密的,可以轻松删除或自毁。
You can send files as large as 1.5 GB each, all media can be stored on the cloud. Most importantly, it is free forever with no ads and no tracking.
您可以发送每个最大1.5 GB的文件,所有媒体都可以存储在云中。 最重要的是,它是永久免费的,没有广告,也没有跟踪。
Telegram allows you to create and join groups, which are your own small communities. You can create open or private groups.
电报允许您创建和加入组,这是您自己的小型社区。 您可以创建开放或私人组。
Telegram also comes with features that are similar Slack, a popular collaboration platform for teams.
Telegram还具有类似于Slack的功能, Slack是团队的流行协作平台。
You can create channels where you can broadcast messages to anyone who joins the channel. Again, channels can also be open or private, your choice.
您可以创建频道,在其中可以向加入频道的任何人广播消息。 同样,您也可以选择开放或私有渠道。
Just like Slack, Telegram also has bots. Anyone can create a bot and make them do things on Telegram.
就像Slack一样,Telegram也有机器人。 任何人都可以创建一个机器人并让他们在Telegram上做事。
The most important feature of Telegram is their API which allows anyone to integrate their own apps with Telegram. There are already hundreds of integrations available for Telegram which you can use. The number of third party apps for Telegram is steadily growing.
Telegram的最重要功能是其API,该API允许任何人将自己的应用程序与Telegram集成。 您已经可以使用数百种适用于Telegram的集成。 Telegram第三方应用程序的数量正在稳步增长。
为什么要在WordPress中使用电报? (Why You Should Use Telegram with WordPress?)
Telegram is a communication app and it’s Slack-like features are making it quite popular among developers and remote teams that rely heavily on online communication tools.
Telegram是一个通信应用程序,它具有类似于Slack的功能,使其在高度依赖在线通信工具的开发人员和远程团队中非常受欢迎。
If you run or manage a small team working on your WordPress site, then Telegram is an ideal choice to be your communication platform.
如果您管理或管理一个在WordPress网站上工作的小型团队,那么Telegram是成为您的交流平台的理想选择。
You can send notifications from your WordPress site to your Telegram group, channel, or profile. You can create private groups for your team for collaboration and communication.
您可以将通知从WordPress网站发送到电报组,频道或个人资料。 您可以为团队创建私人小组,以进行协作和交流。
将电报与WordPress集成 (Integrating Telegram with WordPress)
First thing you need to do is install and activate Telegram for WP plugin. For more details, see our step by step guide on how to install a WordPress plugin.
您需要做的第一件事是安装并激活Telegram for WP插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。
Upon activation, the plugin will add a new menu item labeled ‘TWP Settings’ in your WordPress admin bar. Clicking on it will take you to plugin’s settings page.
激活后,该插件将在您的WordPress管理栏中添加一个名为“ TWP设置”的新菜单项。 单击它会将您带到插件的设置页面。
![Telegram for WordPress settings Telegram for WordPress settings](https://i-blog.csdnimg.cn/blog_migrate/7ef5a9c90ea412775f97f2dc7532dd84.png)
As you can see, it will need a few access tokens to connect with Telegram API. Depending on where you want to send the notification in Telegram, there are different ways to generate API tokens for individual chats, groups, and channels.
如您所见,它将需要一些访问令牌才能与Telegram API连接。 根据您要在Telegram中发送通知的位置,可以使用不同的方法来为各个聊天,群组和频道生成API令牌。
Start by downloading and install Telegram app on your device. It is available for Android, iOS, Mac OS X, Windows, and Linux. If you haven’t already installed it, then simply go to Telegram apps page to download and install the app for your platform.
首先下载并在您的设备上安装Telegram应用程序。 它适用于Android,iOS,Mac OS X,Windows和Linux。 如果尚未安装,则只需转到Telegram应用程序页面下载并安装适合您平台的应用程序。
从WordPress发送通知到电报 (Sending Notifications From WordPress to Telegram)
With Telegram for WP plugin, you can receive your WordPress notification emails directly in your Telegram App. Here is how you would set this up.
使用Telegram for WP插件,您可以直接在Telegram应用程序中接收WordPress通知电子邮件。 这是设置方法。
First you need to start a new chat with notifcaster_bot
in Telegram. Simply click on the search box in the app, and then type notifcaster_bot. Telegram will show you the bot profile, clicking on it will open a chat window.
首先,您需要在Telegram中与notifcaster_bot
开始新的聊天。 只需在应用程序中单击搜索框,然后键入notifcaster_bot。 Telegram将为您显示机器人配置文件,单击它会打开一个聊天窗口。
![Starting a new secret chat in Telegram with notifcaster_bot Starting a new secret chat in Telegram with notifcaster_bot](https://i-blog.csdnimg.cn/blog_migrate/5798cd4e3c4dc971b3a5961381690c00.png)
In the chat window, you need to type /token
to generate an API key. The notifcaster bot will generate one for you, and it will display the token in the chat window.
在聊天窗口中,您需要键入/token
以生成API密钥。 notifcaster机器人将为您生成一个,并在聊天窗口中显示令牌。
![Getting API token from notifcaster bot Getting API token from notifcaster bot](https://i-blog.csdnimg.cn/blog_migrate/e832d2855360d37e0e4d64916f917eae.png)
You need to copy the API token and paste it in the API token field in plugin settings. After that you can send a test message by clicking on the send now button.
您需要复制API令牌并将其粘贴到插件设置的API令牌字段中。 之后,您可以通过单击立即发送按钮发送测试消息。
![Connecting WordPress notifications with Telegram Connecting WordPress notifications with Telegram](https://i-blog.csdnimg.cn/blog_migrate/2994209381015537b49079b2fac78fa2.png)
You will now receive a test message from notificaster bot in Telegram.
您现在将收到来自Telegram中的notificaster bot的测试消息。
If everything worked fine, then you can now click on the save changes button at the bottom of the page to store your settings.
如果一切正常,那么您现在可以单击页面底部的“保存更改”按钮来存储您的设置。
You will now receive notifications from WordPress directly in Telegram. This is particularly helpful if you are having trouble receiving emails from WordPress.
您现在将直接在Telegram中接收来自WordPress的通知。 如果您在接收来自WordPress的电子邮件时遇到问题,这特别有用。
If you want, then you can also send WordPress notifications to a group of users using Telegram. First you will need to create a new group in Telegram and invite the users you want to be included in the group.
如果需要,还可以使用Telegram将WordPress通知发送给一组用户。 首先,您需要在Telegram中创建一个新组,并邀请您想要包含在该组中的用户。
![Creating a new Telegram group Creating a new Telegram group](https://i-blog.csdnimg.cn/blog_migrate/24c1ccd0aa16844dcb0f0f314f77e280.png)
Add at least one other member than yourself to the group. Once you have created the group, it is time to invite notifcaster_bot
to your group.
将您自己以外的成员至少添加一个。 创建群组后,就该邀请notifcaster_bot
加入您的群组了。
Click on your Group name at the top. This will bring you to Group settings. You need to click on the add members and then add notifcaster_bot
to your group.
单击顶部的组名称。 这将带您进入组设置。 您需要单击添加成员,然后将notifcaster_bot
添加到您的组中。
![Adding new members to Telegram group Adding new members to Telegram group](https://i-blog.csdnimg.cn/blog_migrate/96c994f843df2d4656945254a7cbccfd.png)
The notifcaster_bot will now generate a new API key in its own chat window. This API key will start with g:
prefix. Simply copy and paste this api key in plugin settings and save your settings.
现在,notifcaster_bot将在其自己的聊天窗口中生成一个新的API密钥。 该API密钥将以g:
前缀开头。 只需将此api键复制并粘贴到插件设置中,然后保存您的设置。
You will now receive WordPress notifications in the Telegram group. If you are sending the notifications to a group, then you will not receive notifications in the secret chat window with the notifcaster bot.
您现在将在Telegram组中收到WordPress通知。 如果要将通知发送到组,则使用notifcaster机器人在秘密聊天窗口中将不会收到通知。
Make sure that you only add users with admin access to your site in this group. Because, these users will be seeing all notifications that site administrator receive in WordPress.
确保仅将具有管理员访问权限的用户添加到该组中的站点。 因为,这些用户将看到站点管理员在WordPress中收到的所有通知。
将WordPress帖子发送到电报频道 (Sending WordPress Posts to Telegram Channel)
Telegram channels are chatrooms that can be private or public. As a site owner, you can use a Telegram channel for your site’s visitors where they can hangout with other users.
电报频道是可以是私人的也可以是公共的聊天室。 作为网站所有者,您可以为网站的访问者使用电报频道,以便他们可以与其他用户进行环聊。
Let’s see how to create a Telegram channel, and how to send WordPress posts to your Telegram channel.
让我们看看如何创建电报频道,以及如何将WordPress帖子发送到电报频道。
First, you need to create your channel. Simply click on the add new icon and select new channel.
首先,您需要创建自己的频道。 只需单击添加新图标并选择新频道。
![Creating a new Telegram channel Creating a new Telegram channel](https://i-blog.csdnimg.cn/blog_migrate/2f04138f2399309e66a44041ae0579b1.png)
You will be asked to provide a name and description for your channel. You will also get a chance to choose a short URL. You and your users can use this URL to invite other users to the channel.
系统会要求您提供频道的名称和说明。 您还将有机会选择一个简短的URL。 您和您的用户可以使用此URL邀请其他用户加入该频道。
After creating your channel, you will also need to create a Telegram bot. Don’t worry, you don’t need to write any code in order to create a bot in Telegram.
创建频道后,您还需要创建一个Telegram机器人。 不用担心,您无需编写任何代码即可在Telegram中创建机器人。
Open a new secret chat with the botfather.
与Botfather打开新的秘密聊天。
![Start new chat with botfather Start new chat with botfather](https://i-blog.csdnimg.cn/blog_migrate/1f6b4c7a8c20a1feaafb958556eaad21.png)
In the chat window, type /newbot
and botfather will create a new bot for you. It will ask you to choose a name and username for your bot, and then it will show you an API key.
在聊天窗口中,输入/newbot
,botfather将为您创建一个新的bot。 它将要求您选择机器人的名称和用户名,然后将向您显示一个API密钥。
Switch to your Telegram channel, and click on channel name at the top to access channel settings. On the settings screen, you need to click on Administrators.
切换到电报频道,然后单击顶部的频道名称以访问频道设置。 在设置屏幕上,您需要单击管理员。
![Channel options in Telegram Channel options in Telegram](https://i-blog.csdnimg.cn/blog_migrate/3159b6e5bdaefcf6a55aac5fc2d99dc7.png)
This will show you the list of administrators on your channel. You need to click on add administrator and then type the username of the bot you created earlier. Now you will be able to add the bot as an administrator to your channel.
这将向您显示您频道中的管理员列表。 您需要单击添加管理员,然后键入您先前创建的机器人的用户名。 现在,您将能够将该机器人作为管理员添加到您的频道中。
Switch back to botfather chat window and copy the API access token it gave for your bot. Paste this access key in plugin settings next to bot token option.
切换回botfather聊天窗口,并复制为机器人提供的API访问令牌。 将此访问密钥粘贴到bot令牌选项旁边的插件设置中。
![Channel settings in Telegram for WordPress plugin Channel settings in Telegram for WordPress plugin](https://i-blog.csdnimg.cn/blog_migrate/f8f4900110d0117991347f331d851447.png)
Add your channel username with the @ sign. Your channel user name is the same name you used in the channel short URL.
用@符号添加您的频道用户名。 您的频道用户名与您在频道简短URL中使用的名称相同。
Click on Send Now button and the plugin will send a test message to your channel. Don’t forget to click on the save changes button to store your settings.
单击立即发送按钮,插件将向您的频道发送测试消息。 不要忘记单击“保存更改”按钮来存储您的设置。
That’s all, now you can send posts directly from your WordPress site to your Telegram channel. On the post editor screen, you will find the options to choose how you want to send the post to your Telegram channel.
就是这样,现在您可以将帖子从WordPress网站直接发送到Telegram频道。 在帖子编辑器屏幕上,您会找到用于选择将帖子发送到电报频道的方式的选项。
![Send WordPress posts to your Telegram channel Send WordPress posts to your Telegram channel](https://i-blog.csdnimg.cn/blog_migrate/8e1413531e274add0cce8dba2255dadf.png)
When you publish or update a post, the plugin will send a message to your Telegram channel using these settings.
当您发布或更新帖子时,插件将使用这些设置向您的电报频道发送消息。
![New post notification in Telegram channel New post notification in Telegram channel](https://i-blog.csdnimg.cn/blog_migrate/5dfffa26684a79061b35a6f5ef7a15b5.png)
We hope this article helped you learn how to integrate your WordPress site with Telegram. You may also want to see our guide on adding a points system in WordPress to ignite user engagement.
我们希望本文能帮助您学习如何将WordPress网站与Telegram集成。 您可能还想查看有关在WordPress中添加积分系统以激发用户参与度的指南 。
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在Twitter和Facebook上找到我们。
翻译自: https://www.wpbeginner.com/plugins/how-to-integrate-your-wordpress-site-with-telegram/