Hello everyone
I'm working on a workflow where my AI Agent needs to take text input (like a course summary) and write it into Notion in a structured format, including titles, bullet points, and paragraphs.
My goal is to have the Agent handle the formatting directly, rather than manually mapping each block in callin.io.
The issue is that even when I instruct the Agent to use the correct format, I encounter an error when attempting to send the output to Notion.
I suspect I'm overlooking something simple, but I can't pinpoint it.
Here’s my current callin.io workflow:
{
"nodes": [
{
"parameters": {
"formTitle": "Convertir les notes de Coursera",
"formDescription": "=Utilise ce formulaire afin de transformer les transcript de cours coursera en note afin de pouvoir les réviser.",
"formFields": {
"values": [
{
"fieldLabel": "Nom du module",
"placeholder": "Titre module",
"requiredField": true
},
{
"fieldLabel": "Transcription",
"fieldType": "file",
"acceptFileTypes": ".txt",
"requiredField": true
}
]
},
"options": {}
},
"type": "n8n-nodes-base.formTrigger",
"typeVersion": 2.2,
"position": [
-100,
0
],
"id": "f177386a-57b2-46d7-8d00-3961c997a0ed",
"name": "On form submission",
"webhookId": "6348b7ff-2de9-46f1-9a8f-cba8a22d26de"
},
{
"parameters": {
"operation": "text",
"binaryPropertyName": "=Transcription",
"options": {}
},
"type": "n8n-nodes-base.extractFromFile",
"typeVersion": 1,
"position": [
120,
0
],
"id": "4a211079-59eb-43b4-b386-8ea75c0e6c82",
"name": "Extract from File",
"alwaysOutputData": false
},
{
"parameters": {
"promptType": "define",
"text": "={{ $('Extract from File').item.json.data }}",
"options": {
"systemMessage": "=### 🎯 Objectif : Résumer un transcript et ajouter le contenu structuré dans une page NotionnnTu reçois un transcript de cours.nn1. Tu dois produire un résumé **structuré** (titres, sections, bullet points).n2. Tu vas l'ajouter à une page Notion **via l'outil appelé `append_notion_blocks`**.n3. Tu dois découper ton contenu en plusieurs blocs Notion, en utilisant les formats suivants :nn- `heading_1`: pour le titre du résumén- `heading_2`: pour les sectionsn- `bulleted_list_item`: pour les idées principalesn- `paragraph`: pour des explicationsnn4. Tu n’as pas à envoyer tout le contenu en une fois : tu peux appeler plusieurs fois l’outil `append_notion_blocks` avec une liste de blocs à chaque fois (2000 caractères max).nn---nn### ✅ Exemple de format de bloc à utiliser :nn```jsonn{n "type": "heading_2",n "heading_2": {n "rich_text": [n { "type": "text", "text": { "content": "Les fondamentaux de la vente" } }n ]n }n}"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2,
"position": [
960,
0
],
"id": "49e24e0d-73c7-4700-9d04-18a89aebd2c4",
"name": "AI Agent"
},
{
"parameters": {
"model": {
"__rl": true,
"value": "gpt-4.1",
"mode": "list",
"cachedResultName": "gpt-4.1"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
880,
200
],
"id": "f01bd74a-47ae-468e-a0eb-509c1d32ea13",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"id": "nEUxMYfTBw9JTeMf",
"name": "OpenAi account"
}
}
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "chatgpt-4o-latest",
"mode": "list",
"cachedResultName": "CHATGPT-4O-LATEST"
},
"messages": {
"values": [
{
"content": "=Lie le texte et extrait le titre dans la même langue du texte : nn {{ $json.data }}"
},
{
"content": "Tu dois créer un titre à partir d'un texte, tu ne propose jamais plusieurs titre, rien de superflu juste la réponse .nnLe titre doit être dans la même langue du texte",
"role": "system"
}
]
},
"jsonOutput": true,
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.8,
"position": [
340,
0
],
"id": "1d9baa35-acb5-4ade-889d-7086b8b904aa",
"name": "Message a model",
"credentials": {
"openAiApi": {
"id": "nEUxMYfTBw9JTeMf",
"name": "OpenAi account"
}
}
},
{
"parameters": {
"pageId": {
"__rl": true,
"value": "https://www.notion.so/Formation-la-vente-HubSpot-223902c2362080149b2ae62a0d17e378",
"mode": "url"
},
"title": "={{ $json.message.content.titre }}",
"options": {}
},
"type": "n8n-nodes-base.notion",
"typeVersion": 2.2,
"position": [
700,
0
],
"id": "0ba49565-33ef-4a47-9499-f24953001e89",
"name": "Create a page",
"credentials": {
"notionApi": {
"id": "4Y12d0A1j4d7mzEd",
"name": "Notion account"
}
}
},
{
"parameters": {
"resource": "block",
"blockId": {
"__rl": true,
"value": "={{ $json.id }}",
"mode": "id"
},
"blockUi": {
"blockValues": [
{
"richText": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('blockValues0_Rich_Text', ``, 'boolean') }}"
}
]
}
},
"type": "n8n-nodes-base.notionTool",
"typeVersion": 2.2,
"position": [
1120,
300
],
"id": "eadfbb9c-22c3-4067-91c3-9d4bd1a0b489",
"name": "Append notion blocks",
"credentials": {
"notionApi": {
"id": "4Y12d0A1j4d7mzEd",
"name": "Notion account"
}
}
}
],
"connections": {
"On form submission": {
"main": [
[
{
"node": "Extract from File",
"type": "main",
"index": 0
}
]
]
},
"Extract from File": {
"main": [
[
{
"node": "Message a model",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Message a model": {
"main": [
[
{
"node": "Create a page",
"type": "main",
"index": 0
}
]
]
},
"Create a page": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Append notion blocks": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "1148135d8af09935f1fbc9043e7cde1c4aacf716a7ce6f442c7af6891f4db26e"
}
}
❌ Here’s the error I get:
The Notion node requires a block ID for appending children, rather than a page ID. Providing the page's ID might work intermittently or by chance, but it will eventually fail as it's not a valid block reference.
You need to supply a valid Notion block ID, not the page URL or ID, and append blocks iteratively, mapping AI-generated arrays to individual append operations. After this setup, the AI agent's structured output will be successfully integrated into Notion.