March 21st is World Poetry Day, 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.
If this is your first n8n workflow, have a look at our quickstart guide 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 here 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:
- Cron node: triggers the workflow every day at 10:00. You can change the time and interval based on your use case.
- HTTP Request node: makes an HTTP request to the Poemist API that returns random poems.
- LingvaNex node: translates the returned poems into Romanian. You can choose from over 100 languages.
- Telegram node: 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
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 LingvaNex to get credentials. You can find detailed instructions here. 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 Botfather 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 Telegram Trigger node or with a Telegram bot. You can find instructions for both methods here.
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.
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 Twitter or ask for help in our community forum. Feel free to tweak and extend this workflow as you please and share your ideas with us on Twitter 🧡