My variables should be defined but arent, im fairly new to n8n so any help would be apreciated!
Hey @Gesco06 hope all is well, welcome to the community.
Seeing the input would be helpful to understand why your expressions are expressing ![]()
Also try to embed the workflow, so we can take a look.
{
"name": "insta scrape",
"nodes": [
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1.1,
"position": [
80,
0
],
"id": "63a65207-3d06-4761-9d23-a90f2c70f483",
"name": "When chat message received",
"webhookId": "3fd0b86f-bb0f-47c7-8193-586addff7694"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2,
"position": [
460,
0
],
"id": "c01da2fc-2238-40fd-a3c5-ceefddcb7f0d",
"name": "AI Agent"
},
{
"parameters": {
"model": {
"__rl": true,
"value": "gpt-4o-mini",
"mode": "list",
"cachedResultName": "gpt-4o-mini"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
300,
220
],
"id": "82dbcfb3-aece-4a22-a082-dacacb03786d",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"id": "nFeL6mVnmZyJVojK",
"name": "OpenAi account 2"
}
}
},
{
"parameters": {},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
420,
220
],
"id": "5cbd481e-5d6e-4a32-a260-3d7d633f816c",
"name": "Simple Memory"
},
{
"parameters": {
"descriptionType": "manual",
"toolDescription": "Use this tool when you want to send an email. Assign the email address from the message to: {{ $fromAI('placeholder_email')}}. Extract the subject line and assigned it to: {{ $fromAI('placeholder_subject')}}. The message that we went to send in the email needs to be assigned to:{{$fromAI('placeholder_msg')}}.",
"sendTo": "={{$fromAI('placeholder_email')}}",
"subject": "={{ $fromAI ('placeholder_subject')}}",
"message": "={{$fromAI('placeholder_msg')}}",
"options": {}
},
"type": "n8n-nodes-base.gmailTool",
"typeVersion": 2.1,
"position": [
540,
220
],
"id": "add315cd-dbaf-40d8-bd97-54a996b71320",
"name": "Send a message in Gmail",
"webhookId": "3051b5e3-871c-401c-8a9c-a3c765b96542",
"credentials": {
"gmailOAuth2": {
"id": "n3R5JX1xaKUByIXx",
"name": "Gmail account"
}
},
"disabled": true
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.toolSerpApi",
"typeVersion": 1,
"position": [
660,
220
],
"id": "482bb42d-7900-46c8-8832-a0fae5b187bd",
"name": "SerpAPI",
"credentials": {
"serpApi": {
"id": "agn1CVRuUwnBT91w",
"name": "SerpAPI account"
}
}
},
{
"parameters": {
"toolDescription": "=When asked for an Instagram search. \nWhen asked for a specific category. Assign {{$json.category}} to what they are asking for. When they ask for email assign {{$json.emails}} to the email they gave. Assign {{$json.results}} to the number if results is what they are asking for.",
"url": "https://serpapi.com/search",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "api_key"
},
{
"name": "engine",
"value": "google"
},
{
"name": "q",
"value": "=site:instagram.com \"{{$json.category}}\" \"{{$json.emails}}\""
},
{
"name": "google_domain",
"value": "google.com"
},
{
"name": "gl",
"value": "us"
},
{
"name": "hl",
"value": "en"
},
{
"name": "start",
"value": "1"
},
{
"name": "num",
"value": "={{$json.results}}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequestTool",
"typeVersion": 4.2,
"position": [
780,
220
],
"id": "2cc8ac62-a37a-454f-a957-1f6fa48a0803",
"name": "HTTP Request"
}
],
"pinData": {},
"connections": {
"When chat message received": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Send a message in Gmail": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"SerpAPI": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"HTTP Request": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "1786aa06-0108-4792-a5f5-2e73fb99bc4a",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "6bdacdbcf936fa15d7823da866e8751945d082f21833fda91a5a0ba7bca2c5d8"
},
"id": "Y39qz6pIy8mzPqU2",
"tags": []
}```
This is the whole workflow, thanks for the help!
Where exactly are they defined?
{{ $json }} object in the tool will have access to fields:
- sessionId
- action
- chatInput
If you need the tool to deduce these from the message, try using fromAI() instead.
