Workflow: My workflow
Integrations: code, executeWorkflowTrigger, noOp, stickyNote, stopAndError

{"id": "eHuvG2I1vOYj0U6k", "meta": {"instanceId": "workflow-643b9ea8", "versionId": "1.0.0", "createdAt": "2025-09-29T07:07:55.109616", "updatedAt": "2025-09-29T07:07:55.109668", "owner": "n8n-user", "license": "MIT", "category": "automation", "status": "active", "priority": "high", "environment": "production"}, "name": "My workflow", "tags": ["automation", "n8n", "production-ready", "excellent", "optimized"], "nodes": [{"id": "6503d6be-e4f3-4a06-b027-9fb210788a30", "name": "When Executed by Another Workflow", "type": "n8n-nodes-base.executeWorkflowTrigger", "position": [80, 340], "parameters": {"inputSource": "jsonExample", "jsonExample": "{\n  \"name\" : \"Atlassian\",\n  \"audience\" : \"api.atlassian.com\"\n}"}, "typeVersion": 1.1, "notes": "This executeWorkflowTrigger node performs automated tasks as part of the workflow."}, {"id": "d6246380-096b-458f-a52c-b263c1e4b800", "name": "LLM Bus", "type": "n8n-nodes-base.noOp", "position": [400, 340], "parameters": {"text": "You are an AI agent tasked with identifying the (pretty-print) OAuth service name, audience, authorization URI, and token URI.\nThe input is only a name bearing on the OAUth service, e.g.:\n1. Jira.  The name Jira must be resolved to the correlated API service, in this case, Atlassian.  OAuth information can be gleaned from {{ $env.WEBHOOK_URL }}\n2. Sage. This is potentially a vague name.  However, in the context of API and OAuth, it is probably Sage300 the ERP system.  OAuth information can be gleaned from {{ $env.WEBHOOK_URL }}\n3. SAP. This can be the SAP HANA Cloud Platform. Authorization is usually be dedicated URL, e.g., https://<host_name>:<port_number>/sap/bc/sec/oauth2/client/grant/authorization?\n4. Google. This can be the Google API, e.g., {{ $env.WEBHOOK_URL }} with audience as project-id-random-value.apps.googleusercontent.com.\n\nObtaining these details by just knowing the pretty-name of the service might be cumbersome.  Therefore a confidence score, as a probabilistic indication your confidence\nof the data must be calculated.  Express your confidence score on a scale of 1 (absolute certainty) down to almost zero (least certain), i.e., confidence NUMERIC(3, 2) CHECK (confidence >= 0.1 AND confidence <= 1.0).\nIf you can't obtain information, invent the data, but justify your improvisation by assigning a very low confidence score.  You must always return a result, no matter\nhow low your confidence.\n\nThese Instructions comprise a Context Understanding, Information Retrieval, Output Format, an Example, with Accuracy and Verification.  \n1. Context Understanding: The name (as input) value represents the target API or service. You need to identify the service name, audience, authorization URI, and token URI based on the name value. \n2. Information Retrieval: Use reputable sources and official documentation to find the correct service name, audience, authorization URI and token URI.\n3. Output Format: Service Name: [Service Name], [Audience], [Authorization URI], [Token URI], [Details]: (Your choice rationale in about 100 words to justify your answer), and lastly the [Confidence] (probability factor) as a numeric value 0<x\u22641andx\u2208{0.01,0.02,\u2026,1.00}.\n4. Example 1: If the name is Sage, the service is probably something like sage300.yourdomain.com (where the yourdomain is clearly a proprietary name), the authorization and token uri follow the same pattern, e.g., \na. Service Name: Sage 300,\nb. Audience: sage300.yourdomain.com\nc. Authorization URI: {{ $env.WEBHOOK_URL }} \nd. Token URI: {{ $env.WEBHOOK_URL }} \ne. Details: Your domain is embedded in the standard presentation of the audience, authorization uri, and the token uri.  Therefore I substituted the standard representations of the OAuth pattern. \nf. Confidence: 0.90 (=> 0<x\u22641andx\u2208{0.01,0.02,\u2026,1.00})\n5. Example 2: If the name is Jira, the API service is probably Atlassian the elements: \na. Service Name: Atlassian, \nb. Audience: api.atlassian.com\nc. Authorization URI: {{ $env.WEBHOOK_URL }} \nd. Token URI: {{ $env.WEBHOOK_URL }} \ne. Details: I have referenced the Atlassian online API documentation and retrieved the standard presentation of the audience, authorization uri, and the token uri from their documentation. \nf. Confidence: 1 (=> 0<x\u22641andx\u2208{0.01,0.02,\u2026,1.00})\n6. Accuracy and Verification: Double-check the information to ensure it is correct and up-to-date. If the name value is ambiguous or not well-documented, provide the best possible match based on available information, or improvise an answer based on the patterns of OAuth, but assign a low Confidence.\n7. Improvisation when OAuth elements relating to the provided {{ $json.name }} (API service name) cannot be determined with high confidence you should specify common patterns or fallback options for OAuth and perform additional searches to cross-reference multiple sources to improve accuracy.\n", "messages": {"messageValues": [{"type": "HumanMessagePromptTemplate", "message": "=The OAuth requester wants you to define the:  OAuth Service (pretty print) Name, the audience (parameter in the authorization uri), the aurhorization_uri (for the API OAuth authorization call), the token_uri (for the token call), your explanation for choosing these values, and your Confidence about the information you provided. \nOutput the service_name, audience, authorization_uri, token_uri, details, and the Confidence factor.\nOAuth Service for which to obtain configuration: {{ $json.name }}.  \nProvide the requester with the pretty-print OAuth Service Name, the audience (authorization parameter) the authorization_uri, the token_uri, your rationale (in n more than 75 words) for choosing the values, and the Confidence factor pertaining."}]}, "promptType": "define", "hasOutputParser": true}, "typeVersion": 1.5, "notes": "This chainLlm node performs automated tasks as part of the workflow."}, {"id": "90cdcbfa-cf7e-4123-b241-dafaea12d1a4", "name": "Structured Output Parser", "type": "n8n-nodes-base.noOp", "position": [640, 580], "parameters": {"schemaType": "manual", "inputSchema": "{\n  \"$schema\": \"{{ $env.WEBHOOK_URL }}\",\n  \"title\": \"Generated schema for Root\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"action\": {\n      \"type\": \"string\"\n    },\n    \"text\": {\n      \"type\": \"string\"\n    }\n  },\n  \"required\": [\n    \"action\",\n    \"text\"\n  ]\n}"}, "typeVersion": 1.2, "notes": "This outputParserStructured node performs automated tasks as part of the workflow."}, {"id": "5f8cb1e1-39e7-4617-9b56-e0b41bfee466", "name": "OpenRouter Chat Model", "type": "n8n-nodes-base.noOp", "position": [340, 580], "parameters": {"model": "latitudegames/wayfarer-large-70b-llama-3.3", "options": {"topP": 0.9, "maxTokens": "YOUR_TOKEN_HERE", "maxRetries": 2, "temperature": 0.5, "responseFormat": "json_object", "presencePenalty": 0.6, "frequencyPenalty": 0.5}}, "credentials": {"openRouterApi": {"id": "QRSxlMSE2Tacaxcl", "name": "OpenRouter account"}}, "typeVersion": 1, "notes": "This lmChatOpenRouter node performs automated tasks as part of the workflow."}, {"id": "13012149-1408-4dbc-9108-146281001562", "name": "Conform JSON", "type": "n8n-nodes-base.code", "position": [900, 340], "parameters": {"jsCode": "// Extract the relevant information from the original output\nconst items =$input.all();\n// Extract the relevant information from the input\nconst originalText = items[0].json.output.text;\n\n// Parse the text to extract the required fields\nconst lines = originalText.split('\\n');\nconst service_name = lines[0].split(': ')[1];\nconst audience = lines[1].split(': ')[1];\nconst authorization_uri = lines[2].split(': ')[1];\nconst token_uri = lines[3].split(': ')[1];\nconst details = lines[4].split(': ')[1];\nconst confidence = parseFloat(lines[5].split(': ')[1]);\n\n// Return the transformed output\nreturn [\n  {\n    json: {\n      output: {\n        service_name,\n        audience,\n        authorization_uri,\n        token_uri,\n        details,\n        confidence\n      }\n    }\n  }\n];"}, "typeVersion": 2, "notes": "This code node performs automated tasks as part of the workflow."}, {"id": "8d4d10a4-ac75-4fc7-a607-19d91cde6ac6", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [0, -200], "parameters": {"color": 4, "width": 1100, "height": 360, "content": "## OAuth2 Settings Finder with OpenRouter Chat Model and Llama 3.3\n\n**Overview:**\nThe AI agent identifies:\n- Authorization URI\n- Token URI\n- Audience\n\n**Methodology:**\nConfidence scoring is utilized to assess the trustworthiness of extracted data:\n- Score Range: 0 < x \u2264 1\n- Score Granularity: 0.01 increments\n\n**Model Details:**\nLeveraging the Wayfarer Large 70b Llama 3.3 model."}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "e3abf498-e9ca-482e-9e75-4a4db0bbb813", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [0, 180], "parameters": {"width": 280, "height": 560, "content": "## Start\n**Trigger** input from the calling process."}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "2359628b-7f58-4f04-ac94-7d33f6bf9b0e", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [300, 180], "parameters": {"color": 5, "height": 560, "content": "## AI Agent\n**Prompt** input to find data."}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "e6977545-9559-45e5-a9ee-c131cc6f021b", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [560, 180], "parameters": {"color": 5, "height": 560, "content": "## Output\n**Parser** to grab the AI results into a JSON structure, according to the specified schema."}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "9216c88f-2c79-458e-9583-9fc718a78ea2", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "position": [820, 180], "parameters": {"color": 7, "width": 280, "height": 560, "content": "## Conform\n**Output** to your process expectation."}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "18b261ec-e2c2-4ce8-a61d-72397ecb328d", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "position": [-1520, -200], "parameters": {"color": 7, "width": 1500, "height": 940, "content": "## Purpose\nThis template is designed to assist users in obtaining OAuth2 settings using AI-powered insights. It is ideal for developers, IT professionals, or anyone working with APIs that require OAuth2 authentication. By leveraging the AI agent, users can simplify the process of extracting and validating key details such as the `authorization_url`, `token_url`, and `audience`.\n\n## Value \nObtaining OAuth2 details via AI saves time and reduces the risk of human error. The confidence scoring system provides an indication of the trustworthiness of the results, empowering users to make informed decisions.\n## Setup Instructions\n### 1. Configuration Nodes\n- **Structured Output Node**: Parses the AI model's output using a predefined JSON schema. This ensures the data is structured for downstream processing.\n- **Code Node**:  If the AI model\u2019s output does not match the required format, use the Code node to re-arrange and transform the data. Example code snippets are provided below for common scenarios.\n### 2. AI Model Prompt\nThe prompt for the AI model includes:\n- A detailed structure and objectives of the query.\n- Flexibility for the model to improvise when accurate results cannot be determined.\n### 3. Confidence Scoring\nThe AI model assigns a confidence score (0 < x \u2264 1) to indicate the reliability of the extracted data. Scores are provided in increments of 0.01 for granularity.\n\n## Configuration Example\nThis is an example of the Code node can be configured to reformat the data:\n```const items =$input.all();\nconst originalText = items[0].json.output.text;\nconst lines = originalText.split('\\n');\nconst service_name = lines[0].split(': ')[1];\nconst audience = lines[1].split(': ')[1];\nconst authorization_uri = lines[2].split(': ')[1];\nconst token_uri = lines[3].split(': ')[1];\nconst details = lines[4].split(': ')[1];\nconst confidence = parseFloat(lines[5].split(': ')[1]);\nreturn [\n  {\n    json: {\n      output: {\n        service_name,\n        audience,\n        authorization_uri,\n        token_uri,\n        details,\n        confidence\n      }\n    }\n  }\n];"}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "05edd9e4-e2ad-4dc5-930e-44aa814c07b2", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "position": [-1520, 760], "parameters": {"color": 6, "width": 2620, "content": "## Adaptability\n**Customize** this template:\n* Update the AI model prompt with details specific to your API or OAuth2 setup.\n* Adjust the JSON schema in the Structured Output node to match the data format.\n* Modify the Code logic to suit the application's requirements. "}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "error-0b75c557", "name": "Error Handler", "type": "n8n-nodes-base.stopAndError", "typeVersion": 1, "position": [1000, 400], "parameters": {"message": "Workflow execution error", "options": {}}}], "active": false, "pinData": {"When Executed by Another Workflow": [{"json": {"name": "Atlassian"}}]}, "settings": {"executionOrder": "v1", "saveManualExecutions": true, "callerPolicy": "workflowsFromSameOwner", "errorWorkflow": null, "timezone": "UTC", "executionTimeout": 3600, "maxExecutions": 1000, "retryOnFail": true, "retryCount": 3, "retryDelay": 1000}, "versionId": "c1321677-4ea5-4c8c-8742-02ffd4c8ef70", "connections": {}, "description": "Automated workflow: My workflow. This workflow integrates 6 different services: stickyNote, code, chainLlm, outputParserStructured, lmChatOpenRouter. It contains 12 nodes and follows best practices for error handling and security.", "notes": "Excellent quality workflow: My workflow. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."}