Gestion des enregistrements DNS Cloudflare avec un assistant de conversation piloté par l'IA
Ceci est unDevOps, AI Chatbotworkflow d'automatisation du domainecontenant 20 nœuds.Utilise principalement des nœuds comme Code, Switch, SplitOut, HttpRequest, Agent. utilisationAI驱动dechatassistantgestionCloudflare DNS记录
- •Peut nécessiter les informations d'identification d'authentification de l'API cible
- •Clé API OpenAI
- •Informations de connexion à la base de données PostgreSQL
Nœuds utilisés (20)
Catégorie
{
"meta": {
"instanceId": "fe41feb5409a7d5eb53f7743740840b086b13d9f15b9a1b3a5f34f2bb43129c3",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "053140b0-8397-40b4-877d-e784b7ff42d6",
"name": "Note adhésive2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
-96
],
"parameters": {
"color": 7,
"width": 620,
"height": 240,
"content": "# Requirements\n\nFor storing and processing of data in this flow you will need:\n\n- CloudFlare.com API key/token - for retrieving your data (https://dash.cloudflare.com/?to=/:account/api-tokens)\n- OpenAPI credentials (or any other LLM provider) saved - for agent chat\n\n\n"
},
"typeVersion": 1
},
{
"id": "94a62db1-db0f-41d6-b4ca-33c0afa77a77",
"name": "Note adhésive5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
160
],
"parameters": {
"color": 7,
"width": 620,
"height": 604,
"content": "# Author\n\n### Kresimir Pendic\nSenior professional, specializing in automation, AI and data analysis. \n\n### Video overview\nhttps://youtu.be/bqrxn_41K1Y\n\n## Say hi!\nhttps://www.linkedin.com/in/mkdizajn/\n\n### Check out my other templates\n### 👉 https://n8n.io/creators/kres/\n"
},
"typeVersion": 1
},
{
"id": "ee3394d5-ac45-4561-b4c0-ec68961453b9",
"name": "Note adhésive6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
784
],
"parameters": {
"width": 620,
"height": 140,
"content": "# Need help?\nFor getting help with this workflow, please create a topic on the community forums here:\nhttps://community.n8n.io/c/questions/"
},
"typeVersion": 1
},
{
"id": "415e9c96-1bd0-472c-b92e-3ebc1e667a62",
"name": "Note adhésive8",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
-256
],
"parameters": {
"color": 4,
"width": 1480,
"height": 140,
"content": ""
},
"typeVersion": 1
},
{
"id": "d9fc97f1-30a6-4450-b976-8deb32d536e1",
"name": "Note adhésive9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-224,
-224
],
"parameters": {
"color": 4,
"width": 700,
"height": 80,
"content": "# CloudFlare chat ↪️️ get / set DNS records"
},
"typeVersion": 1
},
{
"id": "11b2465a-9298-437d-b49d-b036e14479dc",
"name": "Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
-96
],
"parameters": {
"color": 3,
"width": 840,
"height": 640,
"content": "## Chat step\n\n1. Use what ever LLM model you like - I've tested it with Gemini and GPT 4o-mini - and both work flawlessly.\n\n2. Prepared main get|set TLD DNS records ops with easy prompt, also extend it to other settings or other ops for your CloudFlare if you need"
},
"typeVersion": 1
},
{
"id": "50256a12-4a51-486e-a2be-a98e24b6f85f",
"name": "À la réception du message",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
160,
128
],
"webhookId": "cb890e80-624b-4431-ab35-992849d95cd1",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "d0e313c9-3df3-4fcc-8dd6-8fa0838b812b",
"name": "Modèle de chat OpenAI",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
224,
352
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "YLUlE1oeNyVmySg5",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "fe26fbe4-bd00-446f-b738-84484b07ade4",
"name": "Chat Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
368,
128
],
"parameters": {
"options": {
"systemMessage": "=You are dns manager for CloudFlare\n\nYou have cf_tool that is your source for getting and setting DNS records.\nOnly return answers based from cf_tool.\n\nWhen calling cf_tool, data args to pass for actions are:\n\nIf you need to get dns record, call cf_tool and pass:\n- action: 'get_dns'\n- domain_id: domain id\n\nif you need to set dns record, call cf_tool and pass:\n- action: 'set_dns'\n- domain_id: domain id\n- record_id: id of a record\n- record_type: type of DNS record\n- new_record_content: new value\n\nIf you need to get domains available in CF, call cf_tool and pass:\n- action 'domain'\n\nBefore calling any user query action, first execute get all domains action."
}
},
"typeVersion": 1.9
},
{
"id": "7489f1c5-68dc-46c9-a80c-f104f661898e",
"name": "Get TLDs",
"type": "n8n-nodes-base.httpRequest",
"position": [
608,
608
],
"parameters": {
"url": "https://api.cloudflare.com/client/v4/zones",
"options": {},
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpCustomAuth",
"queryParameters": {
"parameters": [
{
"name": "per_page",
"value": "=100"
}
]
}
},
"credentials": {
"httpCustomAuth": {
"id": "6l2hwj0eyB10vHc2",
"name": "CloudFlare headers"
}
},
"executeOnce": true,
"typeVersion": 4.1
},
{
"id": "2bfd5981-6511-4ce8-944e-f583e577519d",
"name": "Json",
"type": "n8n-nodes-base.code",
"position": [
160,
944
],
"parameters": {
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet inpt = $input.first().json.query;\nlet out = {};\ntry{\n out = JSON.parse(inpt)\n} catch{}\nif( out.action ){\n return {out};\n} else{\n return {};\n}\n"
},
"typeVersion": 2
},
{
"id": "a6d94bec-619d-4863-833d-479cfcac458b",
"name": "Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
576
],
"parameters": {
"color": 6,
"width": 840,
"height": 544,
"content": "## Cloudflare ops\n\n- this is main operation call for getting, setting DNS records"
},
"typeVersion": 1
},
{
"id": "8c84645c-f5a8-41a2-9bad-c93d29f803fa",
"name": "Commutateur",
"type": "n8n-nodes-base.switch",
"position": [
368,
800
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a542a8cc-a11b-41c7-a288-fc0948d002d3",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.out.action }}",
"rightValue": "domain"
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "6b5fa3fd-e4c2-4e01-bffd-f2ea364dc6a5",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.out.action }}",
"rightValue": "get_dns"
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "f3715811-47d8-4cee-b705-ea1ed4ddd0a3",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.out.action }}",
"rightValue": "set_dns"
}
]
}
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "5980e4a6-805b-4266-9039-87ae6034dc66",
"name": "Postgres Chat Mémoire",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
400,
384
],
"parameters": {
"tableName": "langchain_chat_histories",
"contextWindowLength": 6
},
"credentials": {
"postgres": {
"id": "TxgFdIVuxITapbbG",
"name": "Postgres account"
}
},
"typeVersion": 1.3
},
{
"id": "24f1a023-b3b3-4c8c-8878-a008a4a05aba",
"name": "CloudFlare tool",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
608,
384
],
"parameters": {
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $workflow.id }}",
"cachedResultName": "={{ $workflow.id }}"
},
"description": "=Call this tool to make cloudflare oprations. \nPass down only json with needed data",
"workflowInputs": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.2
},
{
"id": "1831596a-e9a6-4d64-a5b6-817c0a1f6c26",
"name": "End",
"type": "n8n-nodes-base.noOp",
"position": [
704,
128
],
"parameters": {},
"typeVersion": 1
},
{
"id": "d1d69661-c963-46aa-9f4e-2b5912a83d21",
"name": "SubCall",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
128,
688
],
"parameters": {},
"typeVersion": 1
},
{
"id": "3645506b-0bae-4868-af6f-ffac27aa42db",
"name": "Host details",
"type": "n8n-nodes-base.splitOut",
"position": [
768,
608
],
"parameters": {
"options": {},
"fieldToSplitOut": "result"
},
"executeOnce": false,
"typeVersion": 1
},
{
"id": "51811193-5d44-4314-b9d7-a5bf317fc535",
"name": "Getter",
"type": "n8n-nodes-base.httpRequest",
"position": [
608,
768
],
"parameters": {
"url": "=https://api.cloudflare.com/client/v4/zones/{{ $json.out.domain_id }}/dns_records",
"options": {},
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpCustomAuth",
"queryParameters": {
"parameters": [
{}
]
}
},
"credentials": {
"httpCustomAuth": {
"id": "6l2hwj0eyB10vHc2",
"name": "CloudFlare headers"
}
},
"executeOnce": true,
"typeVersion": 4.1
},
{
"id": "d78642dd-e0bd-470e-9e0a-c602c80e8f5b",
"name": "Définirter",
"type": "n8n-nodes-base.httpRequest",
"position": [
608,
928
],
"parameters": {
"url": "=https://api.cloudflare.com/client/v4/zones/{{ $json.out.domain_id }}/dns_records/{{ $json.out.record_id }}",
"method": "PATCH",
"options": {},
"sendBody": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "content",
"value": "={{ $json.out.new_record_content }}"
}
]
},
"genericAuthType": "httpCustomAuth"
},
"credentials": {
"httpCustomAuth": {
"id": "6l2hwj0eyB10vHc2",
"name": "CloudFlare headers"
}
},
"typeVersion": 4.1
}
],
"pinData": {},
"connections": {
"2bfd5981-6511-4ce8-944e-f583e577519d": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "7489f1c5-68dc-46c9-a80c-f104f661898e",
"type": "main",
"index": 0
}
],
[
{
"node": "51811193-5d44-4314-b9d7-a5bf317fc535",
"type": "main",
"index": 0
}
],
[
{
"node": "Setter",
"type": "main",
"index": 0
}
]
]
},
"d1d69661-c963-46aa-9f4e-2b5912a83d21": {
"main": [
[
{
"node": "2bfd5981-6511-4ce8-944e-f583e577519d",
"type": "main",
"index": 0
}
]
]
},
"7489f1c5-68dc-46c9-a80c-f104f661898e": {
"main": [
[
{
"node": "3645506b-0bae-4868-af6f-ffac27aa42db",
"type": "main",
"index": 0
}
]
]
},
"fe26fbe4-bd00-446f-b738-84484b07ade4": {
"main": [
[
{
"node": "1831596a-e9a6-4d64-a5b6-817c0a1f6c26",
"type": "main",
"index": 0
}
]
]
},
"3645506b-0bae-4868-af6f-ffac27aa42db": {
"main": [
[]
]
},
"24f1a023-b3b3-4c8c-8878-a008a4a05aba": {
"ai_tool": [
[
{
"node": "fe26fbe4-bd00-446f-b738-84484b07ade4",
"type": "ai_tool",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "fe26fbe4-bd00-446f-b738-84484b07ade4",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Postgres Chat Memory": {
"ai_memory": [
[
{
"node": "fe26fbe4-bd00-446f-b738-84484b07ade4",
"type": "ai_memory",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "fe26fbe4-bd00-446f-b738-84484b07ade4",
"type": "main",
"index": 0
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Avancé - DevOps, Chatbot IA
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
KPendic
@kresWith 15 years on my back, carrying clients' web apps through the storms of bad code, tight deadlines, and ever-changing tech trends, I now do stuff as an AI Automation Engineer, with focus on streamlining backend services, making systems faster, smarter, and more sustainable.
Partager ce workflow