This is an n8n community node for integrating with Distru, a cannabis ERP software. It provides a comprehensive set of operations to interact with the Distru API.
Follow these steps to install this node in your n8n instance:
npm install n8n-nodes-distru
For n8n versions < 0.200, use:
npm install n8n-nodes-distru@^1.0.0
You need to configure your Distru API credentials before using this node:
- Open your n8n instance
- Go to Settings > Credentials
- Click on "Add Credential"
- Search for "Distru API"
- Enter your API Token
- (Optional) Enable "Use Staging" if you want to use the staging environment
- Get Assembly: Retrieve assembly information
- Get Batch: Get batch details
- Get Company: Retrieve company information
- Get Contact: Get contact details
- Get Inventory: Retrieve inventory information
- Get Invoice: Get invoice details
- Get Location: Retrieve location information
- Get Package: Get package details
- Get Payment Method: Retrieve payment method information
- Get Product: Get product details
- Get Purchase: Retrieve purchase information
- Get Sales Order: Get sales order details
- Get Stock Adjustment: Retrieve stock adjustment information
- Get Strain: Get strain details
- Get User: Retrieve user information
- Create Batch: Create a new batch
- Create Product: Create a new product
- Update Product: Update an existing product
- Upsert Invoice: Create or update an invoice
- Upsert Purchase: Create or update a purchase
- Upsert Sales Order: Create or update a sales order
- Invoice Payment: Process invoice payments
- Purchase Payment: Process purchase payments
Most operations support additional fields for filtering and customization:
- Page Number
- Page Size
- Inserted Datetime
- Updated Datetime
- Various IDs for specific resources
{
"operation": "getProduct",
"additionalFields": {
"id": "product-id-here",
"page_size": 1
}
}
{
"operation": "upsertPurchase",
"company_id": "company-id-here",
"billing_location_id": "location-id-here",
"items": [
{
"product_id": "product-id-here",
"quantity": 10,
"price": 100,
"location_id": "location-id-here"
}
]
}
For issues and feature requests, please create an issue on GitHub.
The package currently includes a single consolidated node:
- Company: Get (with filtering and pagination)
- Product: Create, Update, Get (with filtering and pagination)
- Sales Order: Upsert, Get (with filtering and pagination)
Before you begin, ensure you have:
- Node.js version 18.12 or higher
- pnpm package manager (version 9.1 or higher)
-
n8n installed globally (
pnpm install -g n8n
) - A Distru account with API access
- In your n8n instance, go to Settings > Credentials
- Click on New Credential
- Search for "Distru API"
- Enter your Distru API token
- (Optional) Toggle "Use Staging Environment" if you want to use the staging API
If you want to contribute or modify this node:
- Clone the repository:
git clone https://github.com/Sebbytea/distru-n8n.git cd distru-n8n
- Install dependencies:
pnpm install
- Build the package:
pnpm build
- Link to your local n8n installation:
pnpm link
All GET operations (Company, Product, Sales Order) support filtering and pagination via the Additional Fields collection:
- ID: If set, fetches a single record by ID. If not found, falls back to filtering by ID in the collection endpoint.
- Page Number: The page number to fetch (default: 1).
- Page Size: The number of records per page (defaults: 5000 for Company/Product, 500 for Sales Order; these are also the max values).
- Other Filters: Use any other available fields to filter results (e.g., Inserted Datetime, Updated Datetime, Status, etc.).
- Add the Distru node to your workflow
- Select the "Product: Get" operation
- In Additional Fields, set:
- Page Number:
1
- Page Size:
5000
- (Optional) Add filters like Inserted Datetime, Updated Datetime, etc.
- Page Number:
- Run the node to retrieve up to 5000 products on the first page
- Add the Distru node
- Select the "Company: Get" operation
- In Additional Fields, set:
- ID:
<company_id>
- ID:
- Run the node to retrieve the company by ID
- Add the Distru node
- Select the "Sales Order: Get" operation
- In Additional Fields, set:
- Status:
PENDING
- Page Number:
1
- Page Size:
500
- Status:
- Run the node to retrieve the first 500 pending orders
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License.
For support with this node, please:
- Check the GitHub Issues for existing problems and solutions
- Create a new issue if your problem isn't already reported
- Contact Distru support for API-specific questions
Made with ❤️ by Sebastian Tidwell