Digital Developer Conference: Cloud Security 2021 -- Build the skills to secure your cloud and data Register free

Use Terjmat to easily translate text

Terjmat is a multilanguage translation service integrated with the Telegram application that you can use to make chatbot translations easier. The IBM Language Translator service can connect to other IBM services, and these services can be linked to the Telegram application using a Node-RED app. When you link the services, users can easily use the translation app by sending text or voice to your bot. In this tutorial, I walk you through the steps to create a Node-RED boilerplate that’s available on IBM Cloud and link Terjmat to a Telegram app as the user interface using Node-RED flows – in under 20 minutes and using only IBM Cloud services.

Learning objectives

After completing this project, you will understand how to:

  • Create a Node-RED flow
  • Create a Telegram bot
  • Create a translator dialog using Language Translator, Speech to Text, Text to Speech IBM services
  • Integrate Node-RED with Telegram as an interface for Terjmat


To complete the project, you need the following:

Estimated time

For this project, the estimated times are:

  • Creating a bot on Telegram should take less than 5 minutes.
  • Developing the complete application on Node-RED should take less than 20 minutes.
  • Completing the entire project should take approximately 25 minutes.


Creating a Telegram bot

After installing Telegram on a mobile device, search for “BotFather.”


After you find it, send a /newbot command and follow these instructions:

  1. Set a name.
  2. Set a username.
  3. Save the access token for future use.

figure 2

Note: Make sure to create instances of all of the required services for this project before moving to the next steps.

Create a Node-RED starter app

Follow the steps in this tutorial, “Create a Node-RED starter application.”

Configure the Telegram bot

This is a Node-RED editor and you need to add Telegram nodes. To do this:

  1. Select Manage palette from the upper right menu.

    Figure 8

  2. From the Manage palette menu, click the Install tab then search for telegram.

  3. Install node-red-contrib-telegrambot and close the palette menu.

    Figure 9

  4. Search for telegram nodes from the upper left filter section, then drag the Telegram receiver and Telegram sender nodes to the Flow.

    Figure 10

  5. Double-click the Telegram receiver node and click the pencil icon for configuring your bot credentials.

    Figure 11

  6. Complete the Bot-Name and Token fields according to the bot credentials that you created earlier.

    Figure 12

  7. Click Update.

  8. Double-click the Telegram sender node, select the bot credentials that you created in the Telegram receiver node (example_bot in my case), and click Done.

    Figure 13

Now you have configured the Telegram part on Node-RED. You can test it by connecting the Telegram receiver node to the Telegram sender node.

Figure 14

You can send a message to your bot on Telegram and it echoes the message you wrote. That’s because you forwarded the message payload directly to the Telegram sender.

Figure 15

Connecting IBM services

Now that the bot interface is connected to Node-RED and ready to use, let’s start integrating all of the services with the Node-RED application.

  1. Go to the Node-RED application in IBM Cloud and click the Connections tab in the left menu. Click Create connection.

    Figure 16

  2. Connect all of the required services.

    Figure 17

  3. Restage the app to configure the new changes.

    Figure 18

Create the flow

  1. Copy the code from the Terjmat flow file and import it into the Node-RED clipboard.

  2. Configure all of these nodes: Speech to Text, Text to Speech, Language Translator, and Telegram.

  3. Your flow should look like the following figure. Click Deploy.

    Figure 19

Testing your application on Telegram

Figure 20


Node-RED can make things much easier. This tutorial walked you through the steps to create a translator with a Telegram interface. This is a simple and basic example that you can modify and enhance for your own use.