n8n workflow: ERP AI chatbot for Odoo sales module

Nodes:
name: Window Buffer Memory
type: @n8n/n8n-nodes-langchain.memoryBufferWindow
parameters: sessionKey: ={{ $('Chat Trigger').item.json.sessionId }}
sessionIdType: customKey
name: OpenAI Chat Model
type: @n8n/n8n-nodes-langchain.lmChatOpenAi
name: Calculator
type: @n8n/n8n-nodes-langchain.toolCalculator
name: Schedule Trigger
type: n8n-nodes-base.scheduleTrigger
name: Convert to File
type: n8n-nodes-base.convertToFile
parameters: operation: toText
sourceProperty: response.text
name: Save Summary to File
type: n8n-nodes-base.readWriteFile
parameters: options: append: no
fileName: cache.txt
operation: write
name: Get All Opportunities from Odoo
type: n8n-nodes-base.odoo
parameters: options: fieldsList: won_status
description
email_from
contact_name
expected_revenue
resource: opportunity
operation: getAll
returnAll: yes
name: Read Summary From File
type: n8n-nodes-base.readWriteFile
parameters: fileSelector: cache.txt
alwaysOutputData: no
name: If Summary Exists
type: n8n-nodes-base.if
parameters: conditions: options: caseSensitive: yes
typeValidation: strict
combinator: and
conditions: operator: type: string
operation: exists
singleValue: yes
leftValue: ={{ $json.fileName }}
name: Merge Opportunities
type: n8n-nodes-base.aggregate
parameters: aggregate: aggregateAllItemData
name: Extract Text From File
type: n8n-nodes-base.extractFromFile
parameters: operation: text
name: AI Conversational Agent
type: @n8n/n8n-nodes-langchain.agent
parameters: text: ={{ $('Chat Trigger').item.json.chatInput }}
agent: conversationalAgent
options: humanMessage: =TOOLS
------
Assistant can ask the user to use tools to look up information that may be helpful in answering the users original question. The tools the human can use are:

{tools}

{format_instructions}

Answer questions using only the following context: {{ $json.data }}.


USER'S INPUT
--------------------
Here is the user's input (remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else):

{{input}} 
promptType: define
name: Summarize Opportunities
type: @n8n/n8n-nodes-langchain.chainSummarization
parameters: options: summarizationMethodAndPrompts: values: prompt: =Write a summary of the following:


{{ JSON.stringify($json.data) }}

Include important information such as won status and expected revenue for each opportunity. Also include a short description of each oppotunity and keep opportunities separate.

CONCISE SUMMARY: 
combineMapPrompt: =Write a summary of the following:

{{ JSON.stringify($json.data) }}

Include important information such as won status and expected revenue for each opportunity. Also include a short description of each oppotunity and keep opportunities separate.

CONCISE SUMMARY: 
name: OpenAI Summarization Model
type: @n8n/n8n-nodes-langchain.lmOpenAi
parameters: model: __rl: yes
mode: list
value: gpt-4-turbo
cachedResultName: gpt-4-turbo
name: Sticky Note
type: n8n-nodes-base.stickyNote
parameters: width: 446.44549763033154
height: 261.8821936357484
content: # ERP chatbot for Odoo sales module

Set up steps:
* Configure the Odoo credentials
* Configure OpenAI credentials
* Toggle "Make Chat Publicly Available" from the Chat Trigger node.
name: Chat Trigger
type: @n8n/n8n-nodes-langchain.chatTrigger
parameters: public: yes

Connections:
Calculator: ai_tool: node: AI Conversational Agent
type: ai_tool
Chat Trigger: main: node: Read Summary From File
type: main
Convert to File: main: node: Save Summary to File
type: main
Schedule Trigger: main: node: Get All Opportunities from Odoo
type: main
If Summary Exists: main: node: Extract Text From File
type: main
node: Get All Opportunities from Odoo
type: main
OpenAI Chat Model: ai_languageModel: node: AI Conversational Agent
type: ai_languageModel
Merge Opportunities: main: node: Summarize Opportunities
type: main
Save Summary to File: main: node: Read Summary From File
type: main
Window Buffer Memory: ai_memory: node: AI Conversational Agent
type: ai_memory
Extract Text From File: main: node: AI Conversational Agent
type: main
Read Summary From File: main: node: If Summary Exists
type: main
Summarize Opportunities: main: node: Convert to File
type: main
OpenAI Summarization Model: ai_languageModel: node: Summarize Opportunities
type: ai_languageModel
Get All Opportunities from Odoo: main: node: Merge Opportunities
type: main