Path | Duration | Level | Before you start | |
🔴 Integration | 90 min | Advanced | [[09 · Eventos - que el proceso avance solo | Events - letting the process move on its own]] · Notions of REST APIs and JSON · A test endpoint (for example, an n8n flow or a request-capture service) |
Mairu rarely lives alone: there is an ERP with the orders, an MES with the manufacturing orders, a CMMS with the equipment. This lesson teaches you the three ways for information to enter and leave Mairu, and the care each one requires.
🎯 By the end you'll know how to
Choose the right integration route: import, API or Webhook.
Load data in bulk with the import template.
Find and test the endpoints in the Developer Center.
Register an API in Data sources and call it from a Webhook event.
Anticipate the effect of an integration on the form's events.
🧠 The idea: who starts the conversation
Route | Direction | Who starts it | When to use it |
Import | In | A person, occasionally | Initial loads, migrations, master records |
Mairu API | In and out | The other system calls Mairu | The ERP creates responses or tasks, syncs products, users or Assets |
Webhook | Out (and can collect the response) | Mairu calls the other system, from an event, a button or an automation | Send a NOT OK control to the ERP, alert an n8n flow, request data from another application |
⚠️ What comes in via API or import behaves like a new response. The form's events are evaluated for each response created or modified. An import of 500 rows into a form with an email event can generate 500 emails. Always review the events before integrating.
🛠️ Guided practice
Part 1 · Import historical controls
In the Packaging control history, three-dot menu → Import.
Download the template. Use the LibreOffice version if you want to choose the master data with dropdowns.
Fill in three test rows:
Leave the ID empty: this way a new response is created. If you put the ID of an existing response, you replace it.
For the master data use the format Reference – Name (for example,
ENV-L1 – Line 1) or the value as shown in the form.Respect the date format indicated in the header of each column.
Put one of the rows with a NOT OK result.
Upload the file and press Import. The load is done in the background; if there are errors, the progress window indicates the row and the problem.
Check: the three responses appear in the history and calidad.prueba has received one email: the one from the NOT OK row. It is the expected behavior of events.
💡 The master records are also imported: users from Settings > Users, products from Products and entity values from each Entity.
Part 2 · Explore the API
Open Settings > Developer Center.
In Overview locate the base URL, the authentication method (Bearer token in the
Authorizationheader) and the table of supported fields for responses.In Endpoints, open the Forms category and choose the operation to create a response. Review the expected body and the example.
If you have a test token, paste it in the Try it block and create a Packaging control response. Copy the cURL command to give it to the team doing the integration.
⚠️ The token allows reading and writing your organization's data. Request it from support or the account administrator and do not share it over insecure channels.
Part 3 · Send the NOT OK to another system with a Webhook
Register the API. In Settings > Data sources, register your test endpoint: name, base URL and methods.
Create the event. In the Packaging control, Events tab:
When:
Resultis equal toNOT OK.This will happen: Webhook → the registered API, method POST, and the specific endpoint route.
Build the body. In the Body tab, send the control data by inserting form fields, for example:
{
"origen": "Mairu",
"tipo": "control_envasado_no_ok",
"linea": "{linea}",
"producto": "{producto}",
"lote": "{lote}",
"motivo": "{motivo_rechazo}"
}
Collect the response (optional). If the other system returns, for example, an incident number, you can store it in a form field from the Webhook's Response tab, indicating the "address" of the data (for example
incidencia.numero).
Check: save a NOT OK control and verify that the request arrives at your endpoint with the control data.
⚠️ Common mistakes
Importing without reviewing the events. It is the most common cause of email avalanches or tasks scheduled by mistake.
Putting an ID in the template by mistake. That row replaces the existing response with that ID.
"The API doesn't appear in the Webhook." You first have to register it in Data sources.
**Using Run test on calls that create or delete data. The test of the response mapping is a real call** against the other system and cannot be undone.
Designing a bulk integration as if it were manual. If the API creates many responses, they all fire their events. Think about which actions must run when the response comes from another system.
🏋️ Challenge
The ERP wants to automatically create a control task in Mairu every time a manufacturing order starts, with the line, the product and the batch already filled in. With what you have seen in the Developer Center, write (without programming it) the design of the integration: which endpoint you would use, what data the ERP would send, who the task would be assigned to and which Packaging control events would fire when the operator completes it.
📚 Learn more
How to map a Webhook response to form fields
➡️ Next lesson: Final project - design a complete process
