Найдена очень полезная статья:

Оригинал: https://whatswp.com/integrate-wordpress-with-telegram/

 

How to Integrate WordPress with Telegram for Easier Communications

Telegram is a cloud-based messaging app enjoying a growing popularity. It is fast and secure, and comes with rich features for private/public communications and collaboration. To name a few, with Telegram, you can:

  • Communicate with others. Messages are encrypted and can self-destruct.
  • Create groups for your team members or join others’ groups to conduct team communications. The groups can be either private or public.
  • Create private/public channels and broadcast messages to your users.
  • Send large files. The files will be stored on the cloud for free, with no ads problem.

Besides, Telegram offers an API with which you can integrate your own apps including WordPress with it easily. The integration enables you to send notifications to Telegram groups and share posts to Telegram channels directly from the WordPress dashboard, which helps improve the working efficiency and enhance the broadcasting of your site updates. 

If your WordPress site is managed by a remote team relying much on online communications, then Telegram is a great choice. In the tutorial below, we will detail how you can integrate WordPress with Telegram.

Install the Telegram for WP Plugin

Before making any configurations on Telegram, you need to install a plugin named Telegram for WP on your WordPress site. Upon activation, you will see a new menu item – TWP Settings. Click on it to open the settings.

 

On the settings page, you can see two tabs named “Notifications” and “Post to Channel” respectively which refer to the two functions brought by the plugin. For either function to work, you have to fill in the required information like the “API Token”, “Bot Token” and “Channel Name” to enable the plugin to connect the Telegram API. These details can be obtained from Telegram and we will explain how you can access them.

First of all, you need to make sure that you have installed a Telegram app. If you haven’t, then visit this page to download the right app for your platform. Telegram has prepared different apps for Android, iOS, Windows, etc. Also, there is a web client and Chrome app prepared for those who want simple access and do not need to create channels and groups.

Send Notifications to Telegram from Your WordPress Site

This task can be done under the “Notifications” tab of the Telegram for WP plugin. With the proper configurations, the email notifications sent from your WordPress site will be all available in Telegram. And depending on the API Token you use, notifications can be sent to a single Telegram user or a Telegram group.

Send notifications to a single Telegram user

Open the Telegram app and search notifcaster_bot by using the search box on the upper left of the app screen. Then, click on the search result to open a new chat window.

 

Now send the Notifcaster bot a new message of “/token”. This will return you an API key. The API key is generated by the bot automatically, so you won’t wait.

 

Copy the API key and paste it in the text field after “API Token” in the plugin settings. Make sure that you are staying under the “Notifications” tab. Then, you can click on the “Send now” button to send a message to your Telegram app for test. Custom hashtags are also supported.

 

If everything is right, you can see an unread test message sent from Notifcaster bot in your Telegram app.

 

At last, save the changes you have made. If you are having email sending issues with WordPress, now you can feel safe because all WordPress emails will be sent to you via Telegram.

Send notifications to a Telegram group

Besides sending the WordPress notifications to yourself, you can also choose to send all the emails to a Telegram group if your site has multiple administrators. To do this, you first need to create a group in Telegram and get other administrators included in it.

Open your Telegram app and click on the edit icon in the search box. This will generate a popup. On the popup, select “New Group”.

 

After entering a group name, you need to select one or more members from your contacts and click on the “Create” button to complete the creation of the new group. 

 

When these are done, you will have to invite the Notifcaster bot to the group so that notifications can be sent to the group automatically.

Right-click the name of the group created before and click on “View group info”. Then choose “Add Members”.

 

Search for notifcaster_bot and add it to your group. The bot will then automatically generate an API key starting with a “g:” prefix in a secret chat window.

 

This API token is for the group, so you need to copy it and paste it in the “API Token” section of the Telegram for WP plugin. You can also send a test message to the group to make sure things work alright.

 

As soon as the settings are saved, all the users in the Telegram group start receiving the WordPress notifications.

Send WordPress Posts or Pages to a Telegram Channel

A Telegram channel is like a chatroom. Site owners usually create a channel for their visitors to enable the visitors to receive post updates and chat with others. You can do the same thing, too, if you have built an audience of regular visitors.

To share WordPress posts to a Telegram channel, you need to follow the steps below.

Step 1: Create a Telegram Channel

Open the Telegram app and click on the edit icon. In the popup that appears, choose “New Channel”, and on the next screen, provide a name to the channel as well as a description.

 

When the channel is created, you have to make a choice between public channel and private channel. If your choice is the former, you can make a custom short URL which allows you and other users to invite more people to the channel.

At last, you can add members as you do with a group.

Step 2: Create a bot and add it as an administrator

After creating the channel and adding members, you need to create a new bot to connect your WordPress site with the channel so that you can share posts from your WordPress site to Telegram. Fortunately, this is easy to do as no coding is required.

Firstly, search for botfather and start a secret chat with it. 

Secondly, send “/newbot” to BotFather, and you will get a new bot. After choosing the name and username, you can access the API key for the bot.

 

Thirdly, find the Telegram channel and right-click its name to access the channel info. Find the line for administrators and click on it.

 

Now you can see a list of the administrators of your channel. You need to search the username of the bot created before and add the bot as an administrator so that it is granted the capability of broadcasting when new posts are published on your WordPress site.

 

Step 3: Add the bot to WordPress

Go back to the chat with BotFather and copy the API key for the bot that has been added to your channel. Then, log into WordPress dashboard, visit TWP Settingsand open the “Post to Channel” tab. Find “Bot Token” and paste the API key in the text field next to it. After that, enter the channel username beginning with “@”. Clicking the “Send now” button next to the channel username will send a text message to the channel.

 

Step 4: Send posts to the channel

The Telegram for WP plugin supports both WordPress pages and posts, and you get two choices for sharing these contents to the Telegram channel: sending selective posts or sending all posts.

For the former choice, you can configure the Telegram channel options for each individual post. When adding a new post or editing an existing post, simply check “Send this post to channel”. When the post is published or updated, it will be sent to the Telegram channel automatically. For those posts that you don’t want to share, leave the send post checkbox blank.

 

For the latter option, go to the plugin settings, open the “Post to Channel” tab, and choose “Always send to Telegram”. With this enabled, you no longer need to deal with the configurations of individual posts because all posts will be shared when they are published or updated.

Для настройки и подготовке Вашего сайта и его плагинов Вы всегда можете обратиться ко мне - 1943465@gmail.com

 

Как интегрировать WordPress и канал в Телеграмм для эффективного продвижения контента
Метки:         

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *