salesforce-metadata

n8n community nodes for interacting with Salesforce metadata & tooling APIs (Metadata + AI Tool)

Package Information

Released: 10/8/2025
Downloads: 5 weeklyย /ย 26 monthly
Latest Version: 0.1.13

Documentation

n8n-nodes-salesforce-metadata

Community nodes for n8n that connect to Salesforce and expose metadata-focused operations for architects, admins, and developers.

Features

  • ๐Ÿ” OAuth2 and JWT Bearer credential types with inline validation
  • ๐Ÿ“š Describe the global object catalog or a specific SObject via REST
  • ๐Ÿงฉ List metadata components using the Salesforce Metadata API (powered by jsforce)
  • ๐Ÿ› ๏ธ Run guarded Tooling API SOQL queries (SELECT-only, no DML)
  • ๐Ÿ“ˆ Inspect org limits and available REST API versions in a single call
  • ๐Ÿงผ Normalized outputs with ISO date formats and _source lineage tags for downstream nodes
  • ๐Ÿค– Optional Salesforce Metadata Tool node variant designed for n8n AI Agent tool integration

Getting Started

# Install dependencies
npm install

# Build TypeScript โ†’ dist/
npm run build

# Watch for changes during development
npm run dev

# Run unit tests
npm test

Linking into n8n

  1. From your n8n instance, enable community nodes.
  2. Run npm run dev in this repo to start n8n-node-dev.
  3. Inside n8n, add the Salesforce Metadata node. Choose OAuth2 or JWT credentials and run the workflow.

Node Operations

Operation Description Output _source
Describe Global Lists all SObjects with optional standard/custom/searchable filters rest-describe
Describe SObject Returns field metadata and record type info for a single SObject rest-describe
List Metadata Lists components (Apex, Flows, Permission Sets, etc.) via the Metadata API metadata
Tooling Query Executes a paginated, SELECT-only Tooling API query tooling
Org Limits & API Versions Combines /limits and /services/data calls rest-describe

AI Agent Tool Variant

The repository also includes a Salesforce Metadata Tool node (salesforceMetadataTool) that exposes the same operations but with descriptions optimized for Large Language Model (LLM) tool selection inside the AI Agent node. Use it when you want an autonomous agent to dynamically choose which Salesforce metadata information to fetch.

Example usage inside an AI Agent setup:

  1. Add the AI Agent node.
  2. Under Tools, select the Salesforce Metadata Tool.
  3. Provide credentials (OAuth2 or JWT) just like the primary node.
  4. Give the agent instructions such as: "List Apex classes and then describe the Account object fields."

The agent will pick listMetadata followed by describeSObject operations automatically based on its reasoning chain.

Example Workflow JSON

{
  "name": "Salesforce Metadata Discovery",
  "nodes": [
    {
      "parameters": {
        "operation": "listMetadata",
        "types": ["ApexClass", "LightningComponentBundle"],
        "apiVersion": "auto"
      },
      "name": "Salesforce Metadata",
      "type": "n8n-nodes-salesforce-metadata.salesforceMetadata",
      "typeVersion": 1,
      "position": [480, 320],
      "credentials": {
        "salesforceOAuth2Api": {
          "id": "<credential-id>",
          "name": "Salesforce OAuth2"
        }
      }
    }
  ],
  "connections": {}
}

Testing

  • Guard tests confirm Tooling API SOQL is read-only (assertSafeSoql).
  • Serializer tests ensure Metadata API responses become clean JSON with ISO dates.
  • Credential tests verify required fields and helper messaging for OAuth2 & JWT flows.
npm test

Publishing Checklist

  • dist/ contains compiled .js files with type declarations
  • package.json includes n8n.nodes and n8n.credentials metadata
  • ESLint & Prettier keep the codebase consistent (npm run lint, npm run format)
  • Vitest provides fast feedback for critical helpers

License

MIT ยฉ 2025

Discussion