Generate research-backed infographics with GPT-4, kie.ai, and Gmail
Form input → AI web research & prompt optimization → kie.ai image generation → polling → email delivery
- Who
- Marketers, content creators, educators who need data-driven visuals fast
- You get
- Receive a research-backed infographic as email attachment after form submission; detailed error email on failure
Constraints
Prerequisites: accessible n8n instance (self-hosted or cloud). Three credentials required: OpenAI API key (for the Researcher AI agent node), kie.ai API key (as Header Auth, used by Generate Infographic and Check Job Status nodes), and Gmail OAuth2 (for sending emails). Replace the default recipient address '[email protected]' in both Gmail nodes with the actual address. Estimated setup time: ~5 minutes. Costs depend on OpenAI, kie.ai, and email volume; source does not provide specific pricing.
What they did
Template author georgedanp built an automated n8n workflow: users submit infographic requirements via a built-in form (headline, data topic, style, layout, colors, resolution, etc.), an AI Agent calls GPT-4.1-mini with web search to research the topic and generate an optimized image prompt, then submits it to kie.ai's nano-banana-pro model for infographic generation. The workflow polls every 15 seconds for task status (up to 20 retries), emails the finished image as an attachment on success, and sends a detailed error explanation email on failure or timeout.
How it went
Source-reported expected behavior: form submission completes within approximately 5 minutes; recipient receives an infographic email with attachment on success, or a detailed troubleshooting email with error details, task ID, and original request parameters on failure. (author_report)
Worth knowing
1. Polling limit is 20 retries (~5 minutes), after which timeout error handling triggers. 2. Availability and pricing of kie.ai's nano-banana-pro model must be verified independently. 3. Default recipient in both Gmail nodes is [email protected] and must be replaced. 4. Image download URL is parsed from kie.ai's resultJson; format changes may break parsing. 5. This site has not executed the template (reproduction=not_tested); test in an isolated environment before production use. 6. Variable names in node prompts (e.g., $json['Main Headline']) use n8n expression syntax and are not portable to other platforms.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- Generate Infographic node: connect HTTP Header Auth credentials.
- Email Image to User node: connect Gmail OAuth2 credentials.
- Researcher node: connect OpenAI API credentials.
- Check Job Status node: connect HTTP Header Auth credentials.
- Send Error Email node: connect Gmail OAuth2 credentials.
Configuration to replace
- Source template is n8n public workflow #14000 (~19 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use.
Template retrieved: 2026-10-24
Steps
Configure credentials and recipient
After opening the template in n8n, configure credentials in this order: 1) Add your OpenAI API key in the Researcher node (OpenAI Chat Model); 2) Create a Header Auth credential with your kie.ai Bearer token and link it to both Generate Infographic and Check Job Status HTTP Request nodes; 3) Connect your Gmail OAuth2 account in both Email Image to User and Send Error Email nodes; 4) Change the sendTo field from '[email protected]' to the actual recipient address in both Gmail nodes.
Fill the form to trigger workflow
Activate the workflow, then open the form URL provided by the On form submission node. Form fields: Main Headline (5-7 words), Key Data Points (topic/description), Target Audience (dropdown), Tone of Voice (dropdown), Visualization Options (dropdown), Art Style (dropdown), Color Palette (text input), Layout Structure (dropdown), Font Family (dropdown), Information Density (radio), Aspect Ratio (dropdown), Resolution (radio: 1K/2K/4K), Output Format (radio: png/jpg). All fields are required. Submission automatically triggers the workflow.
AI Agent researches topic and builds image prompt
Form data flows into the Build Image Prompt node (AI Agent). This node calls the Researcher (GPT-4.1-mini with web search) to gather required data points, then follows system instructions to convert user requirements into a highly optimized diffusion-model prompt. The prompt emphasizes readability, composition, white space, vector style, and formats the headline as capitalized quoted text "HEADLINE".
Execution prompt · Source text。Build Image Prompt node text parameter (AI Agent system instruction)
=### ROLE You are a world-class Art Director and Prompt Engineer specializing in generative AI for information design. Your goal is to take user requirements and convert them into a highly optimized image generation prompt for a diffusion model. ### YOUR GOAL Create a prompt that results in a clean, legible, and professional infographic. You must prioritize "readability" and "composition" over artistic flair. ### INPUT DATA - Headline: {{ $json['Main Headline'] }} - Data Points: {{ $json['Key Data Points'] }} - Layout: {{ $json['Layout Structure'] }} - Visualization Types: {{ $json['Visualization Options'] }} - Tone of Voice: {{ $json['Tone of Voice'] }} - Style: {{ $json['Art Style'] }} - Information Density: {{ $json['Information Density'] }} - Font Family: {{ $json['Font Family'] }} - Colors: {{ $json['Color Palette'] }} ### TOOLS Use the "Researcher" model, which has access to the Internet, to gather the "Data Points" that are needed for the infographic. ### PROMPT STRUCTURE RULES 1. **Subject & Layout:** Start by defining the image type strictly (e.g., "A vertical infographic vector illustration..."). 2. **Text Handling:** Modern AI models (like Flux or SD3) can render text if it is capitalized and wrapped in quotes. You MUST extract the "Headline" and place it in the prompt as: text "HEADLINE HERE". Do not try to fit all data points as literal text; summarize them as visual icons or short labels. 3. **Style Descriptors:** Use keywords that enforce cleanliness: "white space," "margins," "grid layout," "vector graphics," "adobe illustrator style," "high resolution." 4. **Negative Weighting (Implicit):** phrasing matters. Avoid "cluttered," "messy," "illegible." ### OUTPUT FORMAT Return ONLY the raw prompt string to be sent to the image generator. Do not add conversational filler or the URLs of the sources for "Data Points". ### DYNAMIC PROMPT TEMPLATE (Use this logic) "[Style] infographic featuring text ' [Headline] ' at the top. The layout is [Layout]. Preferred visualization types: [Visualization Types]. Tone of voice: [Tone of Voice]. Art style: [Style]. Information density: [Information Density]. Preferred font family [Font Family]. The design uses a [Colors] color scheme. Key visual elements include: [Convert 'Data Points' into visual metaphors, e.g., if data is 'costs down', describe a downward arrow or coin stack]. High quality, professional graphic design, flat vector art, precise lines, extra white space for readability, typography focused."Submit generation job to kie.ai and start polling
The prompt from Build Image Prompt flows into the Generate Infographic node (HTTP Request), which POSTs to https://api.kie.ai/api/v1/jobs/createTask with model fixed as nano-banana-pro, plus user-selected aspect_ratio, resolution, and output_format from the form. On success, the workflow enters Polling Delay (15s) to wait 15 seconds, then Check Job Status queries https://api.kie.ai/api/v1/jobs/recordInfo. The Route by Job Status node branches on the state field: success → download image; waiting/generating → Increment Retry count and loop back to polling; fail → error handling. The Check Timeout node triggers timeout error handling when retryCount > 20.
Download image and email it, or send error email
Success path: Download Generated Image parses resultUrls[0] from resultJson to fetch the image, and Email Image to User sends it as an attachment to the configured recipient. Error path has three branches: 1) Generation failure (state='fail'): Prepare Error Email extracts errorMessage and taskId, Send Error Email sends details; 2) Polling timeout (>20 retries): email explains timeout with original request info; 3) API error: email includes full error JSON. All error emails contain key original form fields for troubleshooting.
Execution prompt · Source text。Prepare Error Email node jsCode parameter
const input = $input.first().json; const formData = $('On form submission').item.json; let subject, body; if (input.data?.state === 'fail') { subject = 'Infographic generation failed'; body = `Hi,\n\nThe infographic generation failed.\n\n**Error Details:**\n${input.data.errorMessage || 'Unknown error'}\n\n**Task ID:** ${input.data.taskId || input.taskId || 'unknown'}\n\n**Original Request:**\n- Headline: ${formData['Main Headline']}\n- Data Points: ${formData['Key Data Points']}\n- Style: ${formData['Art Style']}\n- Layout: ${formData['Layout Structure']}\n- Aspect Ratio: ${formData['Aspect Ratio']}\n- Resolution: ${formData['Resolution']}`; } else if (input.retryCount !== undefined) { subject = 'Infographic generation timed out'; body = `Hi,\n\nThe infographic generation timed out after 20 polling attempts.\n\n**Task ID:** ${input.taskId || 'unknown'}\n\n**Original Request:**\n- Headline: ${formData['Main Headline']}\n- Data Points: ${formData['Key Data Points']}\n- Style: ${formData['Art Style']}\n- Layout: ${formData['Layout Structure']}\n- Aspect Ratio: ${formData['Aspect Ratio']}\n- Resolution: ${formData['Resolution']}\n\nPlease check the kie.ai dashboard for more details.`; } else { subject = 'Infographic API Error'; body = `Hi,\n\nAn API error occurred during infographic generation.\n\n**Error Details:**\n${JSON.stringify(input, null, 2)}\n\n**Original Request:**\n- Headline: ${formData['Main Headline']}\n- Data Points: ${formData['Key Data Points']}\n- Style: ${formData['Art Style']}\n- Layout: ${formData['Layout Structure']}`; } return [{ json: { subject, body } }];
Prompt you can copy
Setup guidance · Editorial suggestion。Give to setup assistant; confirm inputs and permissions before configuring nodes
This block is the prompt. Ads are never placed here.
You are reproducing an n8n template: use GPT-4 with web search to research a topic, generate an infographic via kie.ai, and deliver results via Gmail. First confirm you have access to an n8n instance, an OpenAI API key, a kie.ai API key (Header Auth), and a Gmail OAuth2 credential. Then configure nodes step by step and replace the default recipient address. The main prompt (Build Image Prompt) is provided as the node's system instruction and requires no modification.
Verify all credentials are in place before activating the workflow. Test with a short topic first to validate end-to-end flow.
Source
Generate research-backed infographics with GPT-4, kie.ai, and Gmail · georgedanp · n8n.io · 2026-03-11
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.