Automate Product Label Printing with n8n and MySQL Integration

This workflow automates product label printing by fetching detailed product and fabric roll data from MySQL and Postgres databases, triggered by webhook calls. It saves time and reduces errors in textile inventory management.
webhook
httpRequest
mySql
+3
Workflow Identifier: 2381
NODES in Use: Webhook, HTTP Request, MySQL, Function, Postgres, Merge
Automate label printing with n8n and MySQL

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Workflow Does

This workflow listens for a webhook request to print a new label for textile products. It solves the problem of slow, error-prone manual label data collection by automatically gathering product and fabric roll details from two databases. The outcome is a clean, combined data set ready for printing an accurate label quickly.

It receives product grade and fabric roll information via an API call, fetches print settings from an internal HTTP API, queries MySQL for detailed product info, and queries Postgres for fabric roll data. Then, it joins all data by a matching ID to output complete label details.


Who Should Use This Workflow

This workflow benefits inventory managers and textile production teams who spend hours manually preparing labels. It reduces errors and saves about 5 hours weekly of manual work. Users who have product grade data in MySQL and fabric roll info in Postgres databases will find this especially useful.

It is also good for anyone wanting to automate label generation triggered by an API call without mixing manual steps or separate systems.


Tools and Services Used

  • n8n Webhook node: To receive API calls triggering label printing.
  • n8n HTTP Request node: To get print configuration from internal API.
  • n8n MySQL node: Queries product grade and details from MySQL database.
  • n8n Function node: Extracts fabric roll IDs from webhook data.
  • n8n Postgres node: Queries fabric roll information from Postgres database.
  • n8n Merge node: Combines product and roll data by movement detail ID for label output.

Inputs, Processing Steps, and Output

Inputs

  • JSON payload via Webhook node containing product grade ID and fabric roll list.
  • Print configuration settings from internal HTTP API.

Processing Steps

  • HTTP Request node fetches latest label format settings from internal API with authentication header.
  • MySQL node runs a parameterized query fetching product grade info, brand, composition, and fabric width based on product grade ID.
  • Function node extracts fabric roll object IDs from webhook data into an array.
  • Postgres node queries fabric roll details where IDs match extracted array from function node.
  • Merge node joins product data and fabric roll data using the shared movement detail ID field.

Output

A single merged dataset combining detailed product and fabric roll information ready for label printing or next processing steps.


Beginner Step-by-Step: How to Use This Workflow in n8n

Step 1: Import the Workflow

  1. Download the workflow file using the Download button on this page.
  2. Inside the n8n editor, click “Import from File” and select the downloaded workflow.

Step 2: Configure Credentials and Settings

  1. Enter MySQL and Postgres credentials in the respective nodes for database access.
  2. Set the URL of the internal print configuration API in the HTTP Request node.
  3. Update any IDs in webhook or database queries if your system uses different values.

Step 3: Test the Workflow

  1. Send a POST request to the webhook URL with sample data matching expected product grade and fabric rolls.
  2. Check the output data for merged detailed label info.

Step 4: Activate for Production

  1. Activate the workflow in n8n to keep it running and responding to real webhook calls.
  2. Connect downstream printing tools or processes to use the merged output data for label generation.

For users running n8n on own servers, see self-host n8n resources for setup help.


Common Problems and Fixes

  • Webhook does not respond or shows 404: Check webhook path is exactly “/emitirEtiqueta” and HTTP method is POST.
  • MySQL query returns no data or errors: Confirm correct MySQL credentials and that query parameters point to existing product grade IDs.
  • Postgres query fails with invalid array error: Verify the function node extracts roll IDs correctly as string array for the SQL IN clause.
  • Merge node doesn’t join data: Ensure both input datasets have the “id_movimentacao_detalhe” field and values match exactly.

Customization Ideas

  • Change print configuration API URL to point to a live environment.
  • Modify the MySQL query in dadosProduto node to add more filters or include other product attributes.
  • Add more columns to Postgres fabric roll query for extra details like weight or batch info.
  • Insert a logging node after the merge node to save or audit the final combined label data.

Summary

✓ Automates label data collection from multiple databases on API trigger.
✓ Reduces manual errors and saves ~5 hours per week.
✓ Outputs a merged, complete data record ready for label printing.
✓ Simple to configure in n8n with webhook trigger and database queries.
✓ Supports textile products with complex fabric roll data.


Automate label printing with n8n and MySQL

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

The Webhook node emitirEtiqueta receives the API request with product grade and fabric roll data to trigger the label printing workflow.
The workflow uses the MySQL node dadosProduto to run a query retrieving product grade, brand, composition, and fabric width based on the product grade ID from the webhook.
The Function node trataRetorno extracts fabric roll object IDs from the webhook payload and formats them into an array for the Postgres query.
The Merge node roloProduto joins the output of the product details from MySQL and fabric roll data from Postgres by matching the id_movimentacao_detalhe field.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.