~2h 34minest. build time
6.5/10difficulty
+1555 XPon completion
Expert
๐Ÿ“š Learn
โš™๏ธ Implement
๐Ÿ“Š Stats & Tips

Automated YouTube Video Scheduling & AI Metadata Generation ๐ŸŽฌ โ€” Automation University

๐Ÿ“– Overview

AI Builder ยท Operations Manager ยท Data Analyst
Build an AI-Powered Tech Radar Advisor with SQL DB, RAG, and Routing Agents
Build an AI-Powered Tech Radar Advisor with SQL DB, RAG, and Routing Agents automates a workflow using AI Agent, AI Memory, Anthropic Claude, Code (JS/Python). It connects 37 nodes to complete the full process end-to-end.
AI AgentAI MemoryAnthropic ClaudeCode (JS/Python)Document LoaderGoogle Docs

๐Ÿ—๏ธ Architecture

37 nodes
๐Ÿš€
Entry Point
Triggered by Google Drive, execute Workflow Trigger. The workflow activates when this condition is met.
โš™๏ธ
Data Processing
5 processing node(s) transform, filter, and route data through the workflow.
๐Ÿค–
AI Layer
15 AI node(s) handle reasoning, language generation, or memory.
๐Ÿ”—
Integrations
Connects to: Google Drive, Document Loader, cron....

โ–ถ๏ธ Animated Playback

Watch it run step by step

Build Challenge

Drag nodes onto the canvas, connect them in order, then grade or reveal the solution.

n8n
Make
Zapier
Activepieces
Power Automate

๐Ÿ”ด n8n Workflow

Drag-and-drop node canvas
โšก
Webhook
Trigger
โœ๏ธ
Set Fields
Build prompt
๐Ÿค–
OpenAI
generateText
๐Ÿ“ค
Respond
Return output

๐Ÿ—๏ธ Guided Build โ€” n8n

Step-by-step
1
Add a Webhook trigger node
Create a new workflow, add a Webhook node. Set the HTTP Method to POST and copy the test URL. Click "Listen for test event" before sending your first request.
๐Ÿ’ก Use the Production URL once the workflow is active โ€” the test URL only works while you're listening.
2
Build the prompt with a Set node
Add a Set node to assemble your prompt string. Use expressions like {{ $json.topic }} to inject incoming data. Store the result in a field called prompt.
๐Ÿ’ก Keep system and user prompts as separate fields โ€” it's cleaner to map them individually into the OpenAI node.
3
Connect the OpenAI node
Add an OpenAI node, select the "Message a Model" operation. Map your {{ $json.prompt }} field into the User Message. Set the model to gpt-4o and Max Tokens to 512.
๐Ÿ’ก Add a system prompt field to the Set node and map it to the System Message โ€” this keeps your instructions separate from user input.
4
Return the result with Respond to Webhook
Add a "Respond to Webhook" node. Set Response Body to {{ $json.message.content }} from the OpenAI output. Activate the workflow and test end-to-end.
๐Ÿ’ก Set Response Code to 200 and Content-Type to application/json โ€” callers expect a proper response, not an empty 200.

๐ŸŽฏ Sandbox Mission

Extend it in n8n
Add a tone parameter
Modify the workflow so the caller can pass a tone field (e.g. "professional", "casual", "witty"). Inject it into the system prompt so the model adapts its output accordingly.
Add an IF node after Set โ€” if tone is empty, default to "professional". Otherwise use the caller's value.

๐ŸŸ  Make Scenario

Mapped from n8n
โšก
Webhooks
Custom webhook
โœ๏ธ
Tools
Set Variable
๐Ÿค–
OpenAI
Create Completion
๐Ÿ“ค
Webhooks
Send response

๐Ÿ—๏ธ Guided Build โ€” Make

Step-by-step
1
Create a scenario with a Custom Webhook
Click Create a new scenario. Search for Webhooks and add Custom webhook as the first module. Save to generate the URL, then click "Run once" to start listening for a test payload.
๐Ÿ’ก POST a JSON body with a prompt key to capture the data structure for mapping in later modules.
2
Set Variable to build your prompt string
Add a Tools โ†’ Set Variable module. Create a variable named fullPrompt and map the webhook's prompt field into it. You can concatenate a system instruction here too.
๐Ÿ’ก Make doesn't have a native "system prompt" field in all OpenAI modules โ€” prepend your instruction directly: "You are X. User says: {{prompt}}"
3
Add OpenAI โ†’ Create a Completion
Search for OpenAI and add "Create a Completion". Set Model to gpt-4o, map your fullPrompt variable into the Prompt field. Set Max Tokens to 512 and Temperature to 0.7.
๐Ÿ’ก Always set Max Tokens explicitly in Make โ€” leaving it blank can result in truncated or empty outputs with no error shown.
4
Return the result via Webhooks โ†’ Send response
Add a Webhooks โ†’ Send response module. Set Status to 200, Body Type to JSON, and paste {"result": "{{choices[].text}}"} mapping the OpenAI output text. Toggle the scenario active.
๐Ÿ’ก Run the scenario once manually before activating to confirm the full data flow end to end.

๐ŸŽฏ Sandbox Mission

Extend it on Make
Add a Router for multiple output formats
After the OpenAI module, add a Router. Route 1 returns the raw text via webhook. Route 2 appends the result to a Google Sheet row. Wire both routes and verify both paths execute cleanly.
Right-click the OpenAI module โ†’ Add route. Each route is independent โ€” the Router fans output to all active routes simultaneously.

โšก Zapier Zap

Mapped from n8n
โšก
Trigger
Webhooks by Zapier
Catch Hook
TRIGGER
โœ๏ธ
Action
Formatter by Zapier
Text โ€” Truncate
๐Ÿค–
Action
OpenAI (GPT-4, DALL-E, Whisper)
Send Prompt
๐Ÿ“ค
Action
Webhooks by Zapier
Return Response

๐Ÿ—๏ธ Guided Build โ€” Zapier

Step-by-step
1
Create a Zap with Webhooks trigger
Click Create Zap. Choose Webhooks by Zapier as the trigger, select Catch Hook. Click Continue and copy the webhook URL. POST a test JSON body containing a prompt key to it.
๐Ÿ’ก Webhooks by Zapier requires a paid plan. On free, use Google Sheets: New Row as trigger and put your prompt in a sheet column instead.
2
Clean the prompt with Formatter
Add Formatter by Zapier โ†’ Text โ†’ Truncate. Set the input to the prompt field from step 1, Max Length to 2000. This prevents oversized inputs from hitting the OpenAI token limit.
๐Ÿ’ก Formatter is also useful here for "Remove HTML" if the prompt could contain markup from a web form.
3
Add OpenAI action โ€” Send Prompt
Search for OpenAI (GPT-4, DALL-E, Whisper) and choose Send Prompt. Map the truncated text into the Prompt field. Choose gpt-4o, set Max Tokens to 512 and Temperature to 0.7.
๐Ÿ’ก The "User Name" field in this Zapier action is optional โ€” but populating it helps with audit logs if multiple users share the Zap.
4
Return the result via Webhooks Response
Add Webhooks by Zapier โ†’ Return Response. Set Status Code to 200 and paste the OpenAI response text into the body field. Publish the Zap and test the full flow.
๐Ÿ’ก Return Response only works when the Zap was triggered by a Webhook Catch Hook โ€” other triggers won't have a return path.

๐ŸŽฏ Sandbox Mission

Extend it on Zapier
Add a Filter step for short prompts
Insert a Zapier Filter between Formatter and OpenAI. Only continue if the prompt length is greater than 10 characters. If it's too short, the Zap stops โ€” no wasted OpenAI tokens on empty inputs.
Add Filter by Zapier โ†’ Only continue if โ†’ Text Length โ†’ Greater than โ†’ 10.

๐Ÿงฉ Activepieces Flow

Mapped from n8n
โšก
HTTP
Webhook Trigger
โš™๏ธ
Code
Build prompt
๐Ÿค–
OpenAI
Ask ChatGPT
๐Ÿ“ค
HTTP
Return response

๐Ÿ—๏ธ Guided Build โ€” Activepieces

Step-by-step
1
Add the Webhook trigger piece
Create a new flow. Click Add Trigger, search for HTTP and select Webhook. Copy the generated URL. The webhook URL is stable โ€” it won't change between test runs.
๐Ÿ’ก POST a body like {"prompt":"Write a haiku about automation"} to capture the shape for mapping downstream.
2
Use a Code piece to build the prompt
Add a Code step. Write a small JS function to assemble a messages array: [{role:"system",content:"..."},{role:"user",content:trigger.body.prompt}]. Return it as messages.
๐Ÿ’ก Activepieces Code steps run server-side Node.js. You can use fetch directly if you need a custom API call instead of a built-in piece.
3
Add OpenAI โ€” Ask ChatGPT
Add the OpenAI piece and select "Ask ChatGPT". Map your Code step's messages output into the Messages field. Set model to gpt-4o and Max Tokens to 512.
๐Ÿ’ก Activepieces keeps the same API connection across all OpenAI pieces โ€” connect credentials once in Settings โ†’ Connections.
4
Return the response to the caller
Add an HTTP piece โ†’ Return Response. Set status 200, body type JSON, and map {{openai.choices[0].message.content}}. Publish the flow and run a live test.
๐Ÿ’ก Activepieces shows a live Run Log after each test โ€” expand each step to see input and output data at that point in the flow.

๐ŸŽฏ Sandbox Mission

Extend it on Activepieces
Log every request to a NocoDB table
After the OpenAI step, add a NocoDB piece to insert a row: store the incoming prompt, the model's response, and a timestamp. This gives you a persistent audit trail of every generate_text call.
Use Activepieces' NocoDB piece โ†’ Create Row. Map fields: prompt, result, createdAt (use {{now}} for timestamp).

๐Ÿ”ต Power Automate Flow

Mapped from n8n
โšก
Trigger
When a HTTP request is received
Instant cloud flow
TRIGGER
โœ๏ธ
Action
Initialize variable
String โ€” promptText
๐Ÿค–
Action
HTTP โ€” POST to OpenAI
api.openai.com/v1/chat/completions
๐Ÿ“ค
Action
Response
Return 200 + body

๐Ÿ—๏ธ Guided Build โ€” Power Automate

Step-by-step
1
Create an Instant cloud flow with HTTP trigger
In Power Automate click Create โ†’ Instant cloud flow. Search for "HTTP request" and select "When a HTTP request is received". Click Save โ€” the POST URL only appears after the first save.
๐Ÿ’ก Paste a sample JSON schema like {"prompt":"string"} into the schema field โ€” Power Automate auto-parses it into named variables.
2
Initialize a variable for the prompt
Add the "Initialize variable" action. Name it promptText, type String, and set the value to triggerBody()?['prompt']. This extracts the prompt from the incoming JSON cleanly.
๐Ÿ’ก Always initialize variables near the top โ€” Power Automate expressions can't reference a variable before it's declared in the flow order.
3
Call the OpenAI API via HTTP action
Add an HTTP action. Method: POST, URI: https://api.openai.com/v1/chat/completions. Add header Authorization: Bearer YOUR_KEY. Body: {"model":"gpt-4o","messages":[{"role":"user","content":"@{variables('promptText')}"]}.
๐Ÿ’ก Store the API key in an Environment Variable or Azure Key Vault reference โ€” never hardcode it in the flow body.
4
Return the result with a Response action
Add a Response action. Status code 200. Body: @{body('HTTP')?['choices']?[0]?['message']?['content']}. This extracts the text from the OpenAI JSON response and returns it to the caller.
๐Ÿ’ก Wrap the HTTP and Response in a Scope named "OpenAI Call" โ€” makes the flow readable and gives you a clean place to add error handling later.

๐ŸŽฏ Sandbox Mission

Extend it on Power Automate
Add error handling with a Scope
Wrap the HTTP action inside a Scope. Add a second Scope set to run "if previous step fails". Inside it, add a Response action that returns status 500 and a JSON error body. This makes your flow resilient to OpenAI outages or bad keys.
Configure the error Scope: click the three dots โ†’ Configure run after โ†’ check "has failed". This is Power Automate's equivalent of a try/catch.
๐Ÿง  LLM Compatibility
Recommended
GPT-4o / GPT-4o-mini
OpenAI
FastLow costJSON mode
Best balance of speed/quality for email drafting and summarisation.
Claude 3.5 Sonnet
Anthropic
Long contextSafe
Excellent for long documents, nuanced tone, and multi-turn support.
Gemini 1.5 Pro
Google
1M contextMultimodal
Use when processing large documents or needing image + text in one step.
Mistral 7B / Mixtral
Mistral AI
Open weightSelf-host
Run locally via Ollama for zero API cost. Best for simple classification and drafts.
Llama 3.1 70B
Meta via Ollama
FreeLocal
Strong open model for production quality replies. Requires GPU server.

All models work with the n8n OpenAI, Anthropic, Google Gemini, and Ollama nodes. Swap models without changing workflow logic โ€” only credentials and model name change.

๐Ÿ† Challenge: Automated YouTube Video Scheduling & AI Metadata Generation ๐ŸŽฌ โ€” Automation University
Recreate the core node chain for this workflow
Study the animated playback above, then build the key node sequence in the canvas below. Match the trigger and processing steps this workflow uses.
โšก Trigger โš™๏ธ Process ๐Ÿ“ค Output Connect them left โ†’ right
Triggers
๐Ÿ”—
Webhook
Trigger
๐Ÿ“ง
Read Email
Trigger
AI
โœ๏ธ
Generate Text
OpenAI / Claude
๐Ÿท๏ธ
Classify
AI Label
Output
๐Ÿ“ฌ
Send Email
Gmail / SMTP
๐Ÿ“จ
Send Message
Slack / Telegram
๐Ÿ“ค
Return Output
Response
Data
๐Ÿ”
Extract Data
Parse fields
โš™๏ธ
Transform
Set / Code
โ†™๏ธ
Drag nodes from the left panel
Click another node to connect โ†’
0%
Grading...

๐Ÿ“Š Live Stats

~2h 34min
Est. Build Time
6.5/10
Difficulty
+1555 XP
On Completion
37
Nodes
--
Builds Completed
--
Rebuilt from Scratch
--
Practice Passes
--
Capstones Shipped
Loading live stats...

โš ๏ธ Common Mistakes

From workflow analysis
โถ
System prompt specificity: Vague system prompts produce inconsistent results. Be explicit about output format, tone, and what the AI should NOT do.
โท
Memory node port: Connect memory via the ai_memory port on the Agent node โ€” NOT the main execution port. Wrong port = no memory.
โธ
Token overflow: Large inputs can exceed context limits. Add a Code node to trim or summarise data before passing to the AI model.
โน
Temperature for structured output: Use temperature 0 when the AI needs to produce structured or deterministic output. Higher values introduce unpredictable formatting.

๐Ÿ—บ๏ธ Active Quests

Complete objectives ยท Earn XP ยท Track mastery

๐Ÿ† Achievements

๐Ÿ—๏ธ
Build Complete
Finish the full guided build to earn this.
๐Ÿงฉ
Mock Builder
Rebuild from scratch and submit to earn this.
๐ŸŽฏ
Practice Pro
Score 70%+ on practice questions.
๐Ÿ‘‘
Capstone Master
Ship the workflow in production.
Achievement Unlocked
4,038
Workflows using this skill
57%
of all AI workflows
12
compatible node types
#1
most common AI skill

What is Generate Text?

๐Ÿง 

Core Concept

Generate Text means invoking a language model (GPT-4, Claude, Gemini, Mistral) inside an n8n workflow to produce a natural language output โ€” a summary, reply, classification label, code snippet, or structured JSON from a prompt.

๐ŸŽฏ

When to Use

Use this skill when the output of a step needs to be written language: email drafts, support replies, content summaries, translation, sentiment labels, entity extraction, or any task where a human would normally read and write.

โšก

Key Inputs

Every Generate Text step needs a prompt (the instruction) and optionally context (documents, previous messages, user data). The prompt is assembled from upstream node output using n8n expressions like {{ "{{" }}$json.body{{ "}}" }}.

๐Ÿ“ค

Key Output

Returns a text string in $json.text or $json.content depending on the node. You can chain the output into Send Email, Write Record, Send Message, or any node that accepts text.

Common Patterns

1

Webhook โ†’ Generate Text โ†’ Send Email

Receive a form submission, generate a personalised reply with GPT-4, send it back. Powers auto-responders, lead follow-up, and support triaging.

2

Read Email โ†’ Generate Text โ†’ Write Record

Parse inbox messages, extract entities or classify intent, log structured output to a database. Reduces manual data entry to zero.

3

Read File โ†’ Generate Text โ†’ Return Output

Ingest PDFs or CSVs, summarise contents with an LLM, return the digest to another system or display in a dashboard.

4

Receive Webhook โ†’ Memory Retrieval โ†’ Generate Text โ†’ Reply

The conversational agent pattern. Retrieves prior context from a vector store, augments the prompt, generates a context-aware reply. Core of every AI chatbot built in n8n.

5

Loop Items โ†’ Generate Text โ†’ Aggregate Data

Process a list (products, tickets, articles) through an LLM in batch. Generate a summary or label for each item, then aggregate results into one output.

Compatible Nodes

๐Ÿค–
OpenAI
GPT-4, GPT-4o
๐Ÿง 
Anthropic
Claude 3.5+
๐Ÿ’Ž
Google Gemini
Gemini Pro
๐ŸŒ
HTTP Request
Custom LLM API
โ›“๏ธ
LangChain Agent
Tool-calling
๐Ÿ”—
Ollama
Local LLMs
๐Ÿช„
Mistral
Mistral 7B+
๐Ÿ”ฎ
Cohere
Command R

Related Skills

Generate Text Workflows

Showing 16 of 4,038
View all 4,038 Generate Text workflows โ†’

Practice Quiz

4 questions ยท Earn up to 80 XP

Question 1 of 4
Which n8n node is the most direct way to call OpenAI's GPT-4 and get a text completion?
Question 2 of 4
You want to summarise incoming Slack messages. What must come BEFORE the Generate Text node?
Question 3 of 4
Which of these tasks would NOT typically use the Generate Text skill?
Question 4 of 4
In n8n, how do you inject a previous node's output into your OpenAI prompt string?
0/4
Quiz Complete
Here's how you did:
โšก +0 XP earned

Build Challenge

Drag nodes onto the canvas, connect them in order, then grade or reveal the solution.

n8n
Make
Zapier
Activepieces
Power Automate

๐Ÿ”ด n8n Workflow

Drag-and-drop node canvas
โšก
Webhook
Trigger
โœ๏ธ
Set Fields
Build prompt
๐Ÿค–
OpenAI
generateText
๐Ÿ“ค
Respond
Return output

๐Ÿ—๏ธ Guided Build โ€” n8n

Step-by-step
1
Add a Webhook trigger node
Create a new workflow, add a Webhook node. Set the HTTP Method to POST and copy the test URL. Click "Listen for test event" before sending your first request.
๐Ÿ’ก Use the Production URL once the workflow is active โ€” the test URL only works while you're listening.
2
Build the prompt with a Set node
Add a Set node to assemble your prompt string. Use expressions like {{ $json.topic }} to inject incoming data. Store the result in a field called prompt.
๐Ÿ’ก Keep system and user prompts as separate fields โ€” it's cleaner to map them individually into the OpenAI node.
3
Connect the OpenAI node
Add an OpenAI node, select the "Message a Model" operation. Map your {{ $json.prompt }} field into the User Message. Set the model to gpt-4o and Max Tokens to 512.
๐Ÿ’ก Add a system prompt field to the Set node and map it to the System Message โ€” this keeps your instructions separate from user input.
4
Return the result with Respond to Webhook
Add a "Respond to Webhook" node. Set Response Body to {{ $json.message.content }} from the OpenAI output. Activate the workflow and test end-to-end.
๐Ÿ’ก Set Response Code to 200 and Content-Type to application/json โ€” callers expect a proper response, not an empty 200.

๐ŸŽฏ Sandbox Mission

Extend it in n8n
Add a tone parameter
Modify the workflow so the caller can pass a tone field (e.g. "professional", "casual", "witty"). Inject it into the system prompt so the model adapts its output accordingly.
Add an IF node after Set โ€” if tone is empty, default to "professional". Otherwise use the caller's value.

๐ŸŸ  Make Scenario

Mapped from n8n
โšก
Webhooks
Custom webhook
โœ๏ธ
Tools
Set Variable
๐Ÿค–
OpenAI
Create Completion
๐Ÿ“ค
Webhooks
Send response

๐Ÿ—๏ธ Guided Build โ€” Make

Step-by-step
1
Create a scenario with a Custom Webhook
Click Create a new scenario. Search for Webhooks and add Custom webhook as the first module. Save to generate the URL, then click "Run once" to start listening for a test payload.
๐Ÿ’ก POST a JSON body with a prompt key to capture the data structure for mapping in later modules.
2
Set Variable to build your prompt string
Add a Tools โ†’ Set Variable module. Create a variable named fullPrompt and map the webhook's prompt field into it. You can concatenate a system instruction here too.
๐Ÿ’ก Make doesn't have a native "system prompt" field in all OpenAI modules โ€” prepend your instruction directly: "You are X. User says: {{prompt}}"
3
Add OpenAI โ†’ Create a Completion
Search for OpenAI and add "Create a Completion". Set Model to gpt-4o, map your fullPrompt variable into the Prompt field. Set Max Tokens to 512 and Temperature to 0.7.
๐Ÿ’ก Always set Max Tokens explicitly in Make โ€” leaving it blank can result in truncated or empty outputs with no error shown.
4
Return the result via Webhooks โ†’ Send response
Add a Webhooks โ†’ Send response module. Set Status to 200, Body Type to JSON, and paste {"result": "{{choices[].text}}"} mapping the OpenAI output text. Toggle the scenario active.
๐Ÿ’ก Run the scenario once manually before activating to confirm the full data flow end to end.

๐ŸŽฏ Sandbox Mission

Extend it on Make
Add a Router for multiple output formats
After the OpenAI module, add a Router. Route 1 returns the raw text via webhook. Route 2 appends the result to a Google Sheet row. Wire both routes and verify both paths execute cleanly.
Right-click the OpenAI module โ†’ Add route. Each route is independent โ€” the Router fans output to all active routes simultaneously.

โšก Zapier Zap

Mapped from n8n
โšก
Trigger
Webhooks by Zapier
Catch Hook
TRIGGER
โœ๏ธ
Action
Formatter by Zapier
Text โ€” Truncate
๐Ÿค–
Action
OpenAI (GPT-4, DALL-E, Whisper)
Send Prompt
๐Ÿ“ค
Action
Webhooks by Zapier
Return Response

๐Ÿ—๏ธ Guided Build โ€” Zapier

Step-by-step
1
Create a Zap with Webhooks trigger
Click Create Zap. Choose Webhooks by Zapier as the trigger, select Catch Hook. Click Continue and copy the webhook URL. POST a test JSON body containing a prompt key to it.
๐Ÿ’ก Webhooks by Zapier requires a paid plan. On free, use Google Sheets: New Row as trigger and put your prompt in a sheet column instead.
2
Clean the prompt with Formatter
Add Formatter by Zapier โ†’ Text โ†’ Truncate. Set the input to the prompt field from step 1, Max Length to 2000. This prevents oversized inputs from hitting the OpenAI token limit.
๐Ÿ’ก Formatter is also useful here for "Remove HTML" if the prompt could contain markup from a web form.
3
Add OpenAI action โ€” Send Prompt
Search for OpenAI (GPT-4, DALL-E, Whisper) and choose Send Prompt. Map the truncated text into the Prompt field. Choose gpt-4o, set Max Tokens to 512 and Temperature to 0.7.
๐Ÿ’ก The "User Name" field in this Zapier action is optional โ€” but populating it helps with audit logs if multiple users share the Zap.
4
Return the result via Webhooks Response
Add Webhooks by Zapier โ†’ Return Response. Set Status Code to 200 and paste the OpenAI response text into the body field. Publish the Zap and test the full flow.
๐Ÿ’ก Return Response only works when the Zap was triggered by a Webhook Catch Hook โ€” other triggers won't have a return path.

๐ŸŽฏ Sandbox Mission

Extend it on Zapier
Add a Filter step for short prompts
Insert a Zapier Filter between Formatter and OpenAI. Only continue if the prompt length is greater than 10 characters. If it's too short, the Zap stops โ€” no wasted OpenAI tokens on empty inputs.
Add Filter by Zapier โ†’ Only continue if โ†’ Text Length โ†’ Greater than โ†’ 10.

๐Ÿงฉ Activepieces Flow

Mapped from n8n
โšก
HTTP
Webhook Trigger
โš™๏ธ
Code
Build prompt
๐Ÿค–
OpenAI
Ask ChatGPT
๐Ÿ“ค
HTTP
Return response

๐Ÿ—๏ธ Guided Build โ€” Activepieces

Step-by-step
1
Add the Webhook trigger piece
Create a new flow. Click Add Trigger, search for HTTP and select Webhook. Copy the generated URL. The webhook URL is stable โ€” it won't change between test runs.
๐Ÿ’ก POST a body like {"prompt":"Write a haiku about automation"} to capture the shape for mapping downstream.
2
Use a Code piece to build the prompt
Add a Code step. Write a small JS function to assemble a messages array: [{role:"system",content:"..."},{role:"user",content:trigger.body.prompt}]. Return it as messages.
๐Ÿ’ก Activepieces Code steps run server-side Node.js. You can use fetch directly if you need a custom API call instead of a built-in piece.
3
Add OpenAI โ€” Ask ChatGPT
Add the OpenAI piece and select "Ask ChatGPT". Map your Code step's messages output into the Messages field. Set model to gpt-4o and Max Tokens to 512.
๐Ÿ’ก Activepieces keeps the same API connection across all OpenAI pieces โ€” connect credentials once in Settings โ†’ Connections.
4
Return the response to the caller
Add an HTTP piece โ†’ Return Response. Set status 200, body type JSON, and map {{openai.choices[0].message.content}}. Publish the flow and run a live test.
๐Ÿ’ก Activepieces shows a live Run Log after each test โ€” expand each step to see input and output data at that point in the flow.

๐ŸŽฏ Sandbox Mission

Extend it on Activepieces
Log every request to a NocoDB table
After the OpenAI step, add a NocoDB piece to insert a row: store the incoming prompt, the model's response, and a timestamp. This gives you a persistent audit trail of every generate_text call.
Use Activepieces' NocoDB piece โ†’ Create Row. Map fields: prompt, result, createdAt (use {{now}} for timestamp).

๐Ÿ”ต Power Automate Flow

Mapped from n8n
โšก
Trigger
When a HTTP request is received
Instant cloud flow
TRIGGER
โœ๏ธ
Action
Initialize variable
String โ€” promptText
๐Ÿค–
Action
HTTP โ€” POST to OpenAI
api.openai.com/v1/chat/completions
๐Ÿ“ค
Action
Response
Return 200 + body

๐Ÿ—๏ธ Guided Build โ€” Power Automate

Step-by-step
1
Create an Instant cloud flow with HTTP trigger
In Power Automate click Create โ†’ Instant cloud flow. Search for "HTTP request" and select "When a HTTP request is received". Click Save โ€” the POST URL only appears after the first save.
๐Ÿ’ก Paste a sample JSON schema like {"prompt":"string"} into the schema field โ€” Power Automate auto-parses it into named variables.
2
Initialize a variable for the prompt
Add the "Initialize variable" action. Name it promptText, type String, and set the value to triggerBody()?['prompt']. This extracts the prompt from the incoming JSON cleanly.
๐Ÿ’ก Always initialize variables near the top โ€” Power Automate expressions can't reference a variable before it's declared in the flow order.
3
Call the OpenAI API via HTTP action
Add an HTTP action. Method: POST, URI: https://api.openai.com/v1/chat/completions. Add header Authorization: Bearer YOUR_KEY. Body: {"model":"gpt-4o","messages":[{"role":"user","content":"@{variables('promptText')}"]}.
๐Ÿ’ก Store the API key in an Environment Variable or Azure Key Vault reference โ€” never hardcode it in the flow body.
4
Return the result with a Response action
Add a Response action. Status code 200. Body: @{body('HTTP')?['choices']?[0]?['message']?['content']}. This extracts the text from the OpenAI JSON response and returns it to the caller.
๐Ÿ’ก Wrap the HTTP and Response in a Scope named "OpenAI Call" โ€” makes the flow readable and gives you a clean place to add error handling later.

๐ŸŽฏ Sandbox Mission

Extend it on Power Automate
Add error handling with a Scope
Wrap the HTTP action inside a Scope. Add a second Scope set to run "if previous step fails". Inside it, add a Response action that returns status 500 and a JSON error body. This makes your flow resilient to OpenAI outages or bad keys.
Configure the error Scope: click the three dots โ†’ Configure run after โ†’ check "has failed". This is Power Automate's equivalent of a try/catch.
๐Ÿง  LLM Compatibility
Recommended
GPT-4o / GPT-4o-mini
OpenAI
FastLow costJSON mode
Best balance of speed/quality for email drafting and summarisation.
Claude 3.5 Sonnet
Anthropic
Long contextSafe
Excellent for long documents, nuanced tone, and multi-turn support.
Gemini 1.5 Pro
Google
1M contextMultimodal
Use when processing large documents or needing image + text in one step.
Mistral 7B / Mixtral
Mistral AI
Open weightSelf-host
Run locally via Ollama for zero API cost. Best for simple classification and drafts.
Llama 3.1 70B
Meta via Ollama
FreeLocal
Strong open model for production quality replies. Requires GPU server.

All models work with the n8n OpenAI, Anthropic, Google Gemini, and Ollama nodes. Swap models without changing workflow logic โ€” only credentials and model name change.

๐Ÿ† Challenge: Customer Support Auto-Reply
Build a workflow that automatically replies to support emails using AI
A customer sends an email โ†’ your workflow reads it, uses GPT-4 to generate a helpful reply, and sends the response back. Build the correct node chain below.
๐Ÿ“ง Read Email โœ๏ธ Generate Text ๐Ÿ“ฌ Send Email Connect them left โ†’ right
Triggers
๐Ÿ”—
Webhook
Trigger
๐Ÿ“ง
Read Email
Trigger
AI
โœ๏ธ
Generate Text
OpenAI / Claude
๐Ÿท๏ธ
Classify
AI Label
Output
๐Ÿ“ฌ
Send Email
Gmail / SMTP
๐Ÿ“จ
Send Message
Slack / Telegram
๐Ÿ“ค
Return Output
Response
Data
๐Ÿ”
Extract Data
Parse fields
โš™๏ธ
Transform
Set / Code
โ†™๏ธ
Drag nodes from the left panel
Click another node to connect โ†’
0%
Grading...