n8n

How to Automate Ollama Chat Data Capture?

Turn chat messages into clean structured data in seconds. Incoming requests are converted into a clear JSON record for lead intake, support triage, or contact updates. Ideal for teams that receive free text and need reliable fields.

When a chat message arrives, the event starts the flow. The text goes to a local Ollama model using a simple prompt that asks for specific fields and includes today’s date. A structured output check compares the model answer to your JSON schema. If the answer does not match the rules, an auto fixer re prompts the same model to repair the format. A final step extracts the JSON object so you can send it to your CRM or database next.

Setup is straightforward with a running Ollama model and your chosen schema. Expect to cut manual parsing from five minutes per chat to under ten seconds while reducing errors. Great for lead intake straight from chat, quick support ticket prep, or clean contact capture without changing your current tools.

What are the key features?

  • Chat message event starts processing as soon as a message arrives
  • Basic LLM Chain sends a clear instruction and passes today’s date
  • Local Ollama model mistral nemo with temperature 0.1 for stable output
  • Structured Output Parser enforces a manual JSON schema for fields like name and surname
  • Auto fixing Output Parser re prompts the same model to repair invalid JSON
  • One model powers both the chain and the fixer for consistent answers
  • Set node extracts the final JSON object for easy handoff to other systems
  • On error path ready for custom alerts or logs if parsing fails

What are the benefits?

  • Reduce manual parsing from 5 minutes per chat to under 10 seconds
  • Improve data accuracy by 90 percent with schema checks
  • Automate 100 percent of message parsing with auto fix retries
  • Handle 5 times more chat volume with the same team size
  • Lower costs and keep data private by using a local model
  • Produce one clean JSON output ready for CRM or database

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Ollama. See the Tools Required section above for links to create accounts with these services.
  3. Install and run Ollama on your machine or server, then pull the model by running ollama pull mistral-nemo:latest.
  4. Open the Ollama Chat Model node in n8n and confirm the model is set to mistral-nemo:latest. Keep temperature at 0.1 and keepAlive at 2h for stable results.
  5. In the Ollama Chat Model node, set up credentials. If unsure, double click the node, then on the 'Credential to connect with' dropdown, click 'Create new credential' and follow the on screen instructions.
  6. Open the Basic LLM Chain node and review the prompt. It asks the model to analyze the incoming message and extract data by your JSON schema. If you change the data source later, update the Prompt Source field here.
  7. Open the Structured Output Parser node and confirm or edit the manual JSON schema. Add or remove fields so it matches what you want to capture, such as name and surname.
  8. Check the Auto fixing Output Parser node. Leave the default repair prompt or adjust the wording to better guide fixes for common format mistakes.
  9. Open the Set node named Extract JSON Output and verify it maps to {{ $json.output }} so the final JSON body is easy to pass to the next step.
  10. Enable the workflow. Send a test chat message to trigger the flow and open Executions to review each step.
  11. If the output fails schema checks, confirm the auto fixer runs. If it still fails, simplify the schema or relax field rules, then test again.
  12. When stable, add your next step after Extract JSON Output, such as sending the JSON to your CRM or database using the app’s node.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Ollama

Sign up

Free tier: $0 (self-hosted local API)

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.