Templates / OpenAI assistant with custom tools

OpenAI assistant with custom tools

Ready for 3.0

by David Roberts ✓ · 14,964 views · created 2023-12-15 · Engineering, AI Chatbot

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 13 nodes and runs when a chat message arrives (plus 1 other trigger). Along the way it connects OpenAI.

How it runs

Trigger: When a chat message arrives (plus 1 other trigger).

  1. OpenAI: work with assistant, with 2 tools (Tool to call the workflow below, Tool: Get current date and time); memory: Simple Memory
  2. List countries? (If): checks a condition and branches into true / false
  3. Mapping data (Code): runs custom JavaScript code
  4. Get the matching country's details (Merge): merges the data from its input branches
  5. Mapping data (Code): runs custom JavaScript code
  6. Concatenate country names (Summarize): summarizes / groups the items
  7. Return specific capital (Edit Fields (Set)): sets 1 field: response
  8. Return country list (Edit Fields (Set)): sets 1 field: response

Services it uses

OpenAI

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

Nodes used (11)

From the author

This workflow shows how you can get your OpenAI assistant to call an n8n workflow as a tool. Since you can put almost any functionality in an n8n workflow, this means you can give your assistant access to almost any data source. Note that to use this…

Excerpt from David Roberts's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.