Automate Your Day with Nodemation: Sending Positive Affirmations to Your Telegram Chat
Getting Started with Nodemation
To begin, you’ll need to install Node.js and npm on your system. If you encounter issues, refer to the official GitHub page for instructions on installing node-gyp on multiple operating systems. Once you’ve met the prerequisites, install the n8n CLI using the following command:
npm install n8n -g
Then, run the n8n CLI with the following command:
n8n
Creating a Workflow that Spreads Positivity
In these uncertain times, we all need a little pick-me-up. Let’s create a workflow that sends daily positive affirmations to your Telegram chat or group.
To start, add a Cron trigger to your workflow, specifying the time you want the affirmations to be sent. Make sure to adjust the settings to your timezone to avoid any issues.
Requesting Data from an API
Next, we’ll use the HTTP Request node to fetch affirmations from affirmations.dev. Search for the HTTP Request node, paste the URL, and execute the workflow. You should receive a successful response with data in JSON format.
{
"affirmation": "Believe you can and you're halfway there.",
"author": "Theodore Roosevelt"
}
Sending Affirmations via Telegram
To send the affirmations via Telegram, we’ll need to set up a Telegram node. First, create a Telegram account, talk to the Botfather to create a bot, and obtain the API token and chat ID. Add these credentials to your n8n credentials section.
Then, connect the HTTP Request node to the Telegram node, using the response data to craft a message with the daily affirmation.
const affirmation = $response.body.affirmation;
const author = $response.body.author;
const message = `Daily Affirmation: "${affirmation}" - ${author}`;
The Power of Nodemation
With minimal code, we’ve created a workflow that requests data from an API and sends it to our Telegram client. The possibilities with Nodemation are endless, and you can explore more advanced workflows, such as:
- Querying data from GraphQL
- Integrating Typeform with Google Sheets
- Scheduling web scraping tasks
The power of Nodemation lies in its ability to automate repetitive tasks and simplify your daily life.