By Meshaal Mohammad Alzohrah | Published October 2, 2018
Artificial IntelligenceSpeech and Empathy
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.
After completing this project, you will understand how to:
To complete the project, you need the following:
For this project, the estimated times are:
After installing Telegram on a mobile device, search for “BotFather.”
After you find it, send a /newbot command and follow these instructions:
Note: Make sure to create instances of all of the required services for this project before moving to the next steps.
To create and configure a Node-RED app:
Select Node-RED Starter, as shown in the following figure.
Complete the fields to create the app:
Wait for a few seconds until the application shows Running, then click Visit App URL.
Enter a username and password, selecting the option to secure your profile so that only authorized users can access it.
Click Go to your Node-RED flow editor.
This is a Node-RED editor and you need to add Telegram nodes. To do this:
Select Manage palette from the upper right menu.
From the Manage palette menu, click the Install tab then search for telegram.
Install node-red-contrib-telegrambot and close the palette menu.
Search for telegram nodes from the upper left filter section, then drag the Telegram receiver and Telegram sender nodes to the Flow.
Double-click the Telegram receiver node and click the pencil icon for configuring your bot credentials.
Complete the Bot-Name and Token fields according to the bot credentials that you created earlier.
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.
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.
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.
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.
Go to the Node-RED application in IBM Cloud and click the Connections tab in the left menu. Click Create connection.
Connect all of the required services.
Restage the app to configure the new changes.
Copy the code from the Terjmat flow file and import it into the Node-RED clipboard.
Configure all of these nodes: Speech to Text, Text to Speech, Language Translator, and Telegram.
Your flow should look like the following figure. Click Deploy.
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.
Learn the issues that you face with conversational design in chatbots
This article summarizes the major messaging platforms, bot frameworks, and artificial intelligence (AI) services you use to develop your chatbot…
Artificial IntelligenceSpeech and Empathy+
Back to top