This workflow follows the Agent → HTTP Request recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "fc2d4921-6f3a-4e07-badd-febc467655fd",
"options": {
"rawBody": true,
"responseData": "{\"status\": \"success\", \"message\": \"Alert received\"}",
"responseHeaders": {
"entries": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-160,
0
],
"id": "34743dc5-f110-4214-a56f-7386562665f0",
"name": "Webhook"
},
{
"parameters": {
"model": {
"__rl": true,
"value": "gpt-4.1",
"mode": "list",
"cachedResultName": "gpt-4.1"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
1344,
224
],
"id": "a3402ee9-6eb4-42bb-ada8-f824ebc401bd",
"name": "OpenAI Chat Model1",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://api.line.me/v2/bot/message/push",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ $json.body }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
2800,
0
],
"id": "ac2e1b30-f3e6-4b66-9b6b-ade75b6e247e",
"name": "Send Message To Line",
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"toolDescription": "get es indices name for next query",
"url": "=http://elasticsearch:9200/_cat/indices/*{{ $fromAI('index-pattern', 'index pattern to list indices we want to use, usually get from data view title', 'string')}}*",
"authentication": "genericCredentialType",
"genericAuthType": "httpBasicAuth",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "format",
"value": "json"
},
{
"name": "s",
"value": "index:desc"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "kbn-xsrf",
"value": "reporting"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequestTool",
"typeVersion": 4.3,
"position": [
1472,
224
],
"id": "19c7e504-3ef7-40fd-bcb0-c88e595a8a3c",
"name": "get_es_indices",
"credentials": {
"httpBasicAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"url": "=http://prometheus:9090/api/v1/rules",
"sendQuery": true,
"queryParameters": {
"parameters": [
{}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequestTool",
"typeVersion": 4.3,
"position": [
1600,
224
],
"id": "53027f61-0756-4b74-b886-06e4bbdbba76",
"name": "get_prometheus_rules"
},
{
"parameters": {
"operation": "text",
"options": {}
},
"type": "n8n-nodes-base.extractFromFile",
"typeVersion": 1,
"position": [
672,
80
],
"id": "d815285a-2be6-4b75-9e6d-40227e07a091",
"name": "Extract from File"
},
{
"parameters": {
"resource": "file",
"operation": "get",
"owner": {
"__rl": true,
"value": "FongX777",
"mode": "name"
},
"repository": {
"__rl": true,
"mode": "name",
"value": "MyTodoApp"
},
"filePath": "=docs/alert_sop/{{ $json.alert_code }}.md",
"additionalParameters": {}
},
"type": "n8n-nodes-base.github",
"typeVersion": 1.1,
"position": [
448,
80
],
"id": "a7797b6a-ae0e-48f2-a352-e184b253c28a",
"name": "Get SOP",
"credentials": {
"githubApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "c353cfb0-538a-4b22-8b25-187b5b3fdf2b",
"name": "alert_code",
"value": "={{ $json.data.alerts[0].labels.priority }}_{{ $json.data.alerts[0].labels.alert_type }}_{{ $json.data.alerts[0].labels.alert_id }}",
"type": "string"
},
{
"id": "2f61d59a-59d6-4f44-b015-07de614573fc",
"name": "priority",
"value": "={{ $json.data.alerts[0].labels.priority }}",
"type": "string"
},
{
"id": "c6875e58-35df-4701-8c06-8c08489e4957",
"name": "annotations",
"value": "={{ $json.data.alerts[0].annotations }}",
"type": "object"
},
{
"id": "e9e89b54-33b8-404f-a4d1-b538b1f0b8fd",
"name": "startsAt",
"value": "={{ $json.data.alerts[0].startsAt }}",
"type": "string"
},
{
"id": "0e6d1103-bf93-436c-8f3e-374d7612d65c",
"name": "endsAt",
"value": "={{ $json.data.alerts[0].endsAt }}",
"type": "string"
},
{
"id": "bfcb8ba2-d8c1-4061-9c4c-18861625313d",
"name": "alertName",
"value": "={{ $json.data.groupLabels.alertname }}",
"type": "string"
},
{
"id": "8d25b00f-b486-4db1-969f-0b42408c6a21",
"name": "labels",
"value": "={{ $json.data.commonLabels }}",
"type": "object"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
224,
0
],
"id": "dac1d310-0ab1-4773-a91b-db4611283b5b",
"name": "Format Input"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "a1311006-0b75-4acf-bdef-b67e7ca7235d",
"name": "sop",
"value": "={{ $json.data }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
896,
80
],
"id": "110b4019-2310-4186-b43f-2efa7cb2c73f",
"name": "Get SOP Data"
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineByPosition",
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
1120,
0
],
"id": "f9b95967-839c-4dfe-8c2b-0114d67bbd2c",
"name": "Final Context Data"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "3bb4e3cf-9f82-4f29-80b5-427f30557454",
"name": "body",
"value": "={{ {} }}",
"type": "object"
},
{
"id": "609c8ad5-808e-48f9-9b98-70f19d2e1dec",
"name": "body.to",
"value": "={{ TODO: fill in your user id }}",
"type": "string"
},
{
"id": "1c1948a6-8f4c-4222-8a2f-44139e6a1696",
"name": "body.messages",
"value": "={{ [ {\"type\": \"text\", \"text\": $json.output} ] }}",
"type": "array"
}
]
},
"options": {
"dotNotation": true
}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
2576,
0
],
"id": "d98c13fe-59be-4edf-bd55-98f8f8d3e11f",
"name": "Prepare Line Message Body"
},
{
"parameters": {
"promptType": "define",
"text": "=You have received a new Prometheus alert.\n\nAlertname: {{ $json.alertName }}\nPriority: {{ $json.priority }}\nSeverity: {{ $json.labels.severity }}\nInstance: {{ $json.labels.service }}\nSummary: {{ $json.annotations.summary }}\nDescription: {{ $json.annotations.description }}\nsop: {{ $json.sop }}\n\nPlease analyze what happened, identify possible causes, and suggest next actions using available tools (Grafana, Prometheus, Elasticsearch, Kibana, GitHub).",
"options": {
"systemMessage": "# Role\n\nYou are an SRE/Observability AI Agent inside an automated n8n workflow.\nYou receive Prometheus alerts and related SOP docs, diagnose symptoms and causes, and provide concise, evidence-based insights.\nYour goal is to help engineers understand what happened and what to do next.\n\n# Instructions\n\n1. Understand SOP, analyze it and combine with the context to decide how to diagnose and troubleshooting\n2. Understand the alert context:\n - Parse the alert payload (alertname, instance, severity, annotations, labels).\n - Identify affected service, component, and environment (stg/prd/dev).\n - Summarize the alert meaning in plain English.\n\n3. Investigate using available tools:\n - get_prometheus_rules \u2192 check which rule triggered the alert.\n - get_es_indices / Get a document in Elasticsearch \u2192 query recent logs.\n - get_many_documents_in_elasticsearch \u2192 bulk log retrieval.\n - get_kibana_data_view \u2192 verify data index or anomalies.\n - get_file_github \u2192 find github files to know details about the error, possible from elasticsearch logs error stacktrace or prometheus alerting rules.\n - list_files_github \u2192 list files in a repo to find relevant runbooks or code.\n - get_grafana_dashboard \u2192 retrieve panel metrics and query expressions.\n - query_prometheus \u2192 fetch relevant metrics, usually used in alert rules or grafana panels.\n\n4. Analyze root cause:\n - Correlate symptoms and possible underlying causes.\n - Look for anomalies: latency spikes, 5xx errors, missing data, high saturation.\n - Distinguish between symptom (what) and cause (why).\n\n5. Compose your output in this format:\n \ud83e\uddfe Alert Summary:\n <brief summary in 1-2 sentences>\n\n \ud83e\udded Suspected Cause:\n <root cause in 1-2 sentences>\n\n \ud83d\udd0d Evidence:\n <metrics/logs/panel data you found, no more than 3 lines>\n\n \ud83e\uddf0 Suggested Action:\n <clear next steps with links to open or runbook link>\n\n6. Be concise, structured, and human-readable (under ~10 lines).\n7. Reference tools and data sources where evidence was found.\n8. If missing data, suggest where to check next.\n\n# Rules\n\n- Do not invent metrics or make up data.\n- Prioritize: Prometheus \u2192 Grafana \u2192 Elasticsearch/Kibana \u2192 GitHub.\n- Always provide reasoning before conclusion.\n- If nothing found, say: \u201cNo direct evidence found. Recommend checking relevant dashboards/logs.\u201d\n- Keep Markdown formatting and emojis for clarity. \n- IMPORTANT: For grafana dashboard, kibana, elasticsearch, prometheus mentioned in the final output, come with \"link\" so that when user receives it, they can follow the step more easily\n- Assume the result will be sent to LINE.\n- IMPORTANT: because the output will be in a json string field, make sure it's valid\n\n# Example Output 1\n\n\ud83e\uddfe Alert Summary:\nHigh 5xx error rate on /api/v1/campaigns for service \"aep-internal-gateway\".\n\n\ud83e\udded Suspected Cause:\nRecent deployment introduced config mismatch causing upstream timeout.\n\n\ud83d\udd0d Evidence:\nGrafana panel 43 shows 5xx spike; Prometheus rule AEP_042 matched >5% for 30m; logs show upstream_response_time >30s.\n\n\ud83e\uddf0 Suggested Action:\nRollback last deployment or verify upstream timeout config. Runbook: <https://appier.atlassian.net/wiki/spaces/AEP/pages/4007886849>\n\n# Example Output 2\n\n\ud83e\uddfe Alert Summary:\nKafka consumer lag exceeded 10k for topic \"campaign_events\" in production.\n\n\ud83e\udded Suspected Cause:\nConsumer group not rebalanced after partition scaling.\n\n\ud83d\udd0d Evidence:\nPrometheus rule KAFKA_010 triggered; Grafana dashboard shows uneven partition load.\n\n\ud83e\uddf0 Suggested Action:\nRedeploy consumers or trigger manual group rebalance.\n\n# Additional Context\n\nPriority Levels:\n\n- P1: Critical, requires immediate attention\n- P2: High, requires attention within 2 hour\n- P3: Medium, requires attention within 24 hours\n\nAvailable tools:\n\n- get_prometheus_rules\n- get_es_indices\n- get_kibana_data_view\n- Get a dashboard in Grafana\n- Get a document in Elasticsearch\n- Get/List files in GitHub\n"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3,
"position": [
1792,
0
],
"id": "4e6121c8-a261-4656-8061-ce8b515d6f3e",
"name": "AI Agent",
"retryOnFail": true,
"maxTries": 2,
"executeOnce": false,
"alwaysOutputData": true,
"onError": "continueErrorOutput"
},
{
"parameters": {
"operation": "getAll",
"indexId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Index_ID', ``, 'string') }}",
"returnAll": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_All', ``, 'boolean') }}",
"options": {}
},
"type": "n8n-nodes-base.elasticsearchTool",
"typeVersion": 1,
"position": [
1728,
224
],
"id": "9534c14f-a05c-48f0-907d-66f90552c3c4",
"name": "get_many_documents_in_elasticsearch",
"credentials": {
"elasticsearchApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "get",
"dashboardUidOrUrl": "http://grafana:3000/d/mytodoapp-api/mytodoapp-api-monitoring?orgId=1"
},
"type": "n8n-nodes-base.grafanaTool",
"typeVersion": 1,
"position": [
1888,
224
],
"id": "f2a0abf6-8348-4197-a18a-98ee1b3d162c",
"name": "get_grafana_dashboard",
"credentials": {
"grafanaApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"resource": "file",
"operation": "get",
"owner": {
"__rl": true,
"value": "FongX777",
"mode": "name"
},
"repository": {
"__rl": true,
"value": "MyTodoApp",
"mode": "name"
},
"filePath": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('File_Path', ``, 'string') }}",
"additionalParameters": {}
},
"type": "n8n-nodes-base.githubTool",
"typeVersion": 1.1,
"position": [
2064,
240
],
"id": "d9297b16-8c36-4f13-afad-806920b85692",
"name": "get_file_github",
"credentials": {
"githubApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"resource": "file",
"operation": "list",
"owner": {
"__rl": true,
"value": "FongX777",
"mode": "name"
},
"repository": {
"__rl": true,
"value": "MyTodoApp",
"mode": "name"
},
"filePath": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('File_Path', ``, 'string') }}"
},
"type": "n8n-nodes-base.githubTool",
"typeVersion": 1.1,
"position": [
2208,
240
],
"id": "81f41787-86a1-4a25-b331-e2cc80c078be",
"name": "list_files_github",
"credentials": {
"githubApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "fromJson",
"options": {}
},
"type": "n8n-nodes-base.extractFromFile",
"typeVersion": 1,
"position": [
32,
0
],
"id": "8f651499-5f7a-4bac-8c5e-2f2f58db9015",
"name": "Extract from File1"
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Extract from File1",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"get_es_indices": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"get_prometheus_rules": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Extract from File": {
"main": [
[
{
"node": "Get SOP Data",
"type": "main",
"index": 0
}
]
]
},
"Get SOP": {
"main": [
[
{
"node": "Extract from File",
"type": "main",
"index": 0
}
]
]
},
"Format Input": {
"main": [
[
{
"node": "Get SOP",
"type": "main",
"index": 0
},
{
"node": "Final Context Data",
"type": "main",
"index": 0
}
]
]
},
"Get SOP Data": {
"main": [
[
{
"node": "Final Context Data",
"type": "main",
"index": 1
}
]
]
},
"Final Context Data": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Prepare Line Message Body": {
"main": [
[
{
"node": "Send Message To Line",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Prepare Line Message Body",
"type": "main",
"index": 0
}
]
]
},
"get_many_documents_in_elasticsearch": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"get_grafana_dashboard": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"get_file_github": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"list_files_github": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Extract from File1": {
"main": [
[
{
"node": "Format Input",
"type": "main",
"index": 0
}
]
]
}
},
"meta": {
"templateCredsSetupCompleted": true
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
elasticsearchApigithubApigrafanaApihttpBasicAuthhttpBearerAuthopenAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
N8N-Tutorial-Final. Uses lmChatOpenAi, httpRequest, httpRequestTool, github. Webhook trigger; 17 nodes.
Source: https://gist.github.com/FongX777/be42aa1d9f2759a9cd1f482410f8ee1c — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow listens for GitHub pull-request events, analyzes changed React/TypeScript files, auto-generates Jest tests via AI, has them reviewed by a second AI pass, and posts suggestions back as PR
This workflow automatically processes new free-trial / lead sign-ups in real time: Catches a webhook from any source (Webflow form, Intercom, custom agent, etc.) Filters out personal / disposable / .e
by Varritech Technologies
This workflow transforms WhatsApp into a powerful personal AI using n8n + Green-API. Send text or voice messages — the assistant understands intent and handles daily tasks automatically. 💰 Expense & i
This n8n template automates appointment booking via WhatsApp Flows with real-time calendar availability, AI-powered intent classification, and CRM synchronization. It transforms manual booking convers