
Tech • AI • Robotics • Game
⏱ ≈ 3 min read · 46-min video — 43 min saved
A practical n8n workflow can pull PokéAPI data, batch and clean it, use OpenAI to pick a balanced three-Pokémon team, validate the result, and send it by email.
Managed n8n hosting is presented as convenient but relatively expensive, with lower-tier plans quickly becoming limiting. A raw VPS is cheaper and offers more freedom, but it requires manual installation, updates and terminal work. The middle-ground approach highlighted here is a preconfigured VPS deployment that keeps infrastructure control while simplifying setup.
The workflow starts with deploying n8n from an application catalog, then completing basic account details to reach the editor. From there, a new workflow is created with a simple manual trigger, the easiest way to test logic before introducing scheduled runs, forms, chat inputs or app events.
The first real action uses an HTTP Request node to query PokéAPI, illustrating a common automation pattern: a web address returns machine-readable data instead of a human-friendly page. A request for Pikachu returns fields such as name, weight and nested abilities, showing how API responses mix simple values and structured lists.
The workflow then switches to a PokéAPI endpoint that returns 50 Pokémon at once, each with a name and a URL to its full record. A Split Out node turns that list into individual items, so a second HTTP Request can fetch detailed data for each Pokémon one by one.
Pulling 50 full records at once can slow down execution or trigger rate limits. To reduce that risk, requests are batched in groups of 10 with a 3,000-millisecond pause between batches. That adds time to the run but improves reliability when working with public APIs.
Raw Pokémon records contain far more information than needed, so an Edit Fields node keeps only the useful attributes: name, type, HP, attack, defense, speed, and a computed total. The total is calculated directly in the workflow by summing selected base stats, turning a large JSON payload into a usable comparison table.
Once cleaned, the data is narrowed with a Filter node that keeps only Pokémon whose total is at least 250. In the example, that reduces the pool from 50 to 24. A Sort node orders them from strongest to weakest, and a Limit node keeps the top 10.
Before sending anything to a language model, the top 10 results are grouped into one payload. This makes it easier to pass structured information to OpenAI in a single prompt. The setup stresses that AI should be used for tasks that require judgment, not for deterministic work like querying APIs or doing arithmetic.
An OpenAI node is configured with an API key and a low-cost model such as GPT-4o mini. A system instruction asks the model to act as an experienced trainer, choose exactly three Pokémon, prefer complementary types, include speed and durability when possible, and answer only in JSON. The user message injects the top-10 dataset into that prompt.
The AI result is not trusted blindly. An If node checks that the returned team contains three members and that every chosen name exists in the original grouped dataset. This guardrail is meant to catch hallucinations or malformed output before the automation moves on.
If validation passes, a Gmail node sends the selected team by email. The message can be improved by switching from plain text to HTML, producing a cleaner layout. The workflow also underlines basic security hygiene: API keys should be treated like passwords and given expiration dates where possible.
The workflow shows how n8n can combine API calls, data transformation, validation and selective AI use in one pipeline. The key lesson is that reliable automation comes from structured data handling and safeguards, not from using AI at every step.
Ask a question