Content Applications

Multi-Channel Content Management via the Telegram Chatbot

Enrique Peñaranda

Liquid Content from DNN Software provides a powerful and flexibleAPI to integrate with other applications and systems. This is an excerpt from my tutorial on how to implement a Telegram bot to can interact with your Liquid Content.

Let’s imagine the following use case:  ACME Electronics co. has an DNN Evoq website where their products are displayed. On that site, customers can write reviews about the products. John Smith, the Content Manager, reads the reviews currently in draft status and publishes them to the site.

The problem is that John is traveling and continuously in meetings, so it would be good if he had an easy way to make his revisions. ACME Electronics provides him with a telegram bot with which John is able to interact from his smart phone in order to read and publish the customer reviews.

DNN Reviewer is built as a Telegram bot that allows users to publish drafted reviews created by the site customers.


Content Type. A new content type is needed to be created on the site. The Content Type used by the bot is named Review and has two properties: *Name: Required property, single line text *Comment: Multi Line Text

API Key. A Content Library API Key is needed by the bot to communicate with the Content API. So we also have to create a new API Key on the Evoq site.

Installing Node.js. DNN Reviewer is a Node.js application, so you need to download and install Node.js to launch it. You can do it here

Creating the Bot on Telegram. First, let’s create the bot on Telegram, you can do this following the simple steps explained here The bot creation generate an authorization token. For this example, we can create a bot named DNN Reviewed, set the user pic of the bot and the /getdrafts and /publish commands.

Implementing the bot. Let’s start by a Node.js application. Our bot is implemented by these four files in our src/ folder:

  • app.js: The main file of our application. It contains the bot logic using Telegraf.
  • config.js: Simple file where we are going to include our Telegram bot token and our API Key.
  • reviewManager.js: We will include some business logic to manage our review objects here.
  • reviewService.js: On this file, we will include the logic to make the requests to the Liquid Content API.

Bot code. The bot is a Node.js application. To be implemented, we will use Telegraf, a Telegram bot framework for Node.js.

config.js. The API Key of the site and the Telegram token of the bot have to be included on src/config.js file from the bot code:


.js. We have to include an array variable to store the reviews object that we are going to receive from the Liquid Content API and some functions to manage it.

For example, we can include a get and a set functions and another function that convert the stored review info to a string that we can use to show they.

reviewService.js.We need our bot to do two different request. One request to get the pending reviews from the Liquid Content API and another request to update one request to the published status. Both of the requests will be sent to the same endpoint:


Using the bot

Using the bot is as simple as chat on Telegram.

/getdrafts - this command make the bot load the last five reviews not published and reply a message assigning they an index from 1 to 5, as we can see below:

/publish - this command update the indicate review to published. The command has to be followed by the index of the review (The index value is what the /getdraft command assigned to the review). If the index is not included with the command, then the bot ask the user for it and provides buttons with the possible options.

The review from user W.T. is now published and visible on the Evoq.