The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "AI Email Writer API",
"description": null,
"active": true,
"isArchived": false,
"nodes": [
{
"parameters": {
"path": "ai-email-api",
"responseMode": "responseNode",
"httpMethod": "POST",
"options": {
"responseHeaders": {
"entries": [
{
"name": "Access-Control-Allow-Origin",
"value": "*"
},
{
"name": "Access-Control-Allow-Headers",
"value": "Content-Type"
}
]
}
}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
200,
300
],
"id": "webhook-node",
"name": "Webhook"
},
{
"parameters": {
"promptType": "define",
"text": "=Write an email with the following parameters:\n- Type: {{ $json.body.type || \"professional\" }}\n- Tone: {{ $json.body.tone || \"friendly\" }}\n- Context: {{ $json.body.context || \"general inquiry\" }}\n- Recipient: {{ $json.body.recipient || \"someone\" }}",
"options": {
"systemMessage": "You are a professional email writer. You will receive a JSON object with email parameters and must write a complete, well-formatted email.\n\nBased on the input:\n- Email type: The kind of email (professional, casual, follow-up, cold-outreach, thank-you, etc.)\n- Tone: The desired tone (friendly, formal, persuasive, apologetic, etc.)\n- Context: What the email is about\n- Recipient: Who the email is for\n\nWrite a complete email with Subject line and Body. Format it clearly.\nReturn ONLY the email content, nothing else. Start with \"Subject:\" then a blank line then the body."
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2.2,
"position": [
500,
300
],
"id": "ai-agent-node",
"name": "AI Agent"
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
500,
500
],
"id": "openai-model-node",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ JSON.stringify({ \"email\": $json.output }) }}",
"options": {
"responseHeaders": {
"entries": [
{
"name": "Access-Control-Allow-Origin",
"value": "*"
},
{
"name": "Access-Control-Allow-Headers",
"value": "Content-Type"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
}
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
800,
300
],
"id": "respond-node",
"name": "Respond to Webhook"
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1",
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": false
},
"staticData": null,
"meta": null,
"activeVersionId": "c1c105bf-a623-4ce2-afcd-a392ddfac24e",
"versionCounter": 14,
"triggerCount": 1,
"shared": [
{
"updatedAt": "2026-03-01T23:54:04.135Z",
"createdAt": "2026-03-01T23:54:04.135Z",
"role": "workflow:owner",
"workflowId": "UPQAuic77yXaqmWG",
"projectId": "jISBlT19NO0fn5mT",
"project": {
"updatedAt": "2025-11-19T23:58:51.301Z",
"createdAt": "2025-11-19T23:57:07.759Z",
"id": "jISBlT19NO0fn5mT",
"name": "Armani Cunningham <hamstudios101@gmail.com>",
"type": "personal",
"icon": null,
"description": null,
"creatorId": "a8e49b89-e536-45ff-8330-fab9f0943ab1"
}
}
],
"tags": [],
"activeVersion": {
"updatedAt": "2026-03-02T01:03:30.800Z",
"createdAt": "2026-03-02T01:03:30.800Z",
"versionId": "c1c105bf-a623-4ce2-afcd-a392ddfac24e",
"workflowId": "UPQAuic77yXaqmWG",
"nodes": [
{
"parameters": {
"path": "ai-email-api",
"responseMode": "responseNode",
"httpMethod": "POST",
"options": {
"responseHeaders": {
"entries": [
{
"name": "Access-Control-Allow-Origin",
"value": "*"
},
{
"name": "Access-Control-Allow-Headers",
"value": "Content-Type"
}
]
}
}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
200,
300
],
"id": "webhook-node",
"name": "Webhook",
"webhookId": "ai-email-api-wh"
},
{
"parameters": {
"promptType": "define",
"text": "=Write an email with the following parameters:\n- Type: {{ $json.body.type || \"professional\" }}\n- Tone: {{ $json.body.tone || \"friendly\" }}\n- Context: {{ $json.body.context || \"general inquiry\" }}\n- Recipient: {{ $json.body.recipient || \"someone\" }}",
"options": {
"systemMessage": "You are a professional email writer. You will receive a JSON object with email parameters and must write a complete, well-formatted email.\n\nBased on the input:\n- Email type: The kind of email (professional, casual, follow-up, cold-outreach, thank-you, etc.)\n- Tone: The desired tone (friendly, formal, persuasive, apologetic, etc.)\n- Context: What the email is about\n- Recipient: Who the email is for\n\nWrite a complete email with Subject line and Body. Format it clearly.\nReturn ONLY the email content, nothing else. Start with \"Subject:\" then a blank line then the body."
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2.2,
"position": [
500,
300
],
"id": "ai-agent-node",
"name": "AI Agent"
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
500,
500
],
"id": "openai-model-node",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"id": "xVvmBQ0k0B49oB4q",
"name": "n8n free OpenAI API credits"
}
}
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ JSON.stringify({ \"email\": $json.output }) }}",
"options": {
"responseHeaders": {
"entries": [
{
"name": "Access-Control-Allow-Origin",
"value": "*"
},
{
"name": "Access-Control-Allow-Headers",
"value": "Content-Type"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
}
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
800,
300
],
"id": "respond-node",
"name": "Respond to Webhook"
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
}
},
"authors": "Armani Cunningham",
"name": null,
"description": null,
"autosaved": false,
"workflowPublishHistory": [
{
"createdAt": "2026-03-02T01:03:31.461Z",
"id": 341,
"workflowId": "UPQAuic77yXaqmWG",
"versionId": "c1c105bf-a623-4ce2-afcd-a392ddfac24e",
"event": "activated",
"userId": "a8e49b89-e536-45ff-8330-fab9f0943ab1"
}
]
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApi
About this workflow
AI Email Writer API. Uses agent, lmChatOpenAi. Webhook trigger; 4 nodes.
Source: https://github.com/mhmdmnsor292003-arch/free-ai-tools/blob/main/workflows/ai-email-writer-api.json — original creator credit. Request a take-down →