paint-brush
Using an API to Return a Daily Poem in Telegram to Celebrate World Poetry Day by@lorena
349 reads
349 reads

Using an API to Return a Daily Poem in Telegram to Celebrate World Poetry Day

by LorenaMarch 22nd, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Learn how to create an automated workflow with n8n that gets international poems, translates them into one language, and sends a poem in Telegram every day.

Company Mentioned

Mention Thumbnail
featured image - Using an API to Return a Daily Poem in Telegram to Celebrate World Poetry Day
Lorena HackerNoon profile picture
March 21st is , a day dedicated to one of the most treasured ways of expression around the world and linguistic diversity. I have always loved reading poetry with creative rhymes and melodic rhythm, and lately, I have come to appreciate free verse poetry as well. In any case, I would like to make time to read more poetry and discover new international poets. To achieve this goal, I created an n8n workflow that sends a poem translated into Romanian in my Telegram chat every day. In this article, I’ll show you how to set it up.

Workflow

If this is your first n8n workflow, have a look at our first to learn how to install n8n. Once you have your n8n Editor UI open, there are two ways to follow this tutorial: either copy the workflow from into your Editor UI and deactivate the nodes, so that you can execute and test each node separately, or add the nodes one at a time.
This workflow consists of four nodes:1. : triggers the workflow every day at 10:00. You can change the time and interval based on your use case.2.: makes an HTTP request to the that returns random poems.3. : translates the returned poems into Romanian. You can choose from over 100 languages.4. : posts the translated poems in the chat.Now let’s see how to set up each node.

1. Set the time

First, you need to set the time and interval at which you want to receive poems in the chat. For this, set up the Cron node, where you can choose from seven modes and set the exact hour and minute. For this example, the workflow will be triggered every day at 10:00.

2. Get the poems

Now, you need to get the poems. For this, set up the HTTP Request node to get data from . Paste the and execute the node to test that it’s working.

3. Translate the poems

The Poemist API includes poems in different languages, which on one hand is great for linguistic diversity, but on the other hand, it can be challenging if you don’t know the language.

To make sure you can read all poems, translate them into a language of your choice using the LingvaNex node. For this, you need to sign up on to get credentials. You can find detailed instructions . Copy your credentials in LingvaNex API, then set Translate to Romanian (or any other language you prefer).

In the Text field, select:

The title: Current Node > Input data > JSON > 0 > title

The author: Current Node > Input data > JSON > 0 > poet > name

The poem: Current Node > Input data > JSON > 0 > content

Now execute the node to test that it’s working.

4. Send poems to Telegram

Finally, you need to send the requested poems to your Telegram chat. In your Telegram account, start a chat with and follow the instructions to create a bot and get credentials. Then, go to the Telegram node and add the credentials to Telegram API.

Next, you need to fill in the Chat ID of the newly created bot. There are two ways to get your Telegram Chat ID: with the or with a Telegram bot. You can find instructions for both methods .

After completing the Chat ID, you need to set up the text you want to send to the chat. Open the Text field and select the poem translation from Current node > Input Data > JSON > result. You can add more text or emojis to prettify the message.

Now execute the whole workflow and check your Telegram for an incoming message:
Finally, save and activate the workflow, so that it runs every day at the scheduled time.

Next steps

That was it! Now you know how to get international poems, translate them, and send them to a Telegram chat to get your daily dose of poetry. If you run into issues while following this tutorial, you can message me on or ask for help in our .
바카라사이트 바카라사이트 온라인바카라