Skip to content

Automation · Collections and receivables

Create an Alegra sales invoice draft with human approval

Verify the customer, products, prices, and taxes, then create an Alegra invoice draft only after fresh approval. No issuance and no automatic retry.

How do I create an Alegra sales invoice draft after reviewing it?

From Meteor's web platform, the Met verifies the account, an existing customer, and every Alegra product or service. It reads the pre-tax price, tax ids, and stock when the item tracks it, then shows the customer, dates, lines, and the operation's expected total. It ends the turn and waits for explicit approval in a new message. Only then does it call crear_pedido with confirmar as the literal boolean true. The handler validates every field before the network, fixes status to draft, never forwards confirmar, and makes one POST. It reports the number, status, total, and currency returned by Alegra. It does not issue an electronic invoice, record payment, send email, or generate a PDF.

What starts it

When someone asks for it

A person starts the task in the web platform with the sale to save as a draft. The Met prepares the summary and stops. A later message must approve those exact fields. Any change replaces the summary and invalidates the previous approval.

A manual task: someone on the team runs it with a button, or asks the Met for it in chat.

Who runs it

Alegra administration Met

Finance and operations team

It supports a person working from the desk, prepares one concrete document, preserves Alegra as the source of truth, and separates human review from the single write.

What you need connected

6 steps · 8 tools

The procedure, step by step

Each step shows the tool that runs. They belong to the real connector: if one of them stopped existing, this page would not build.

  1. 1

    Verify the account and administrative preconditions

    The Met reads the company to get the actual account country, currency, and time zone. Alegra must already have a preferred numbering template, because this tool cannot select one and the API returns an error when it cannot use the preferred template. Reading the country does not validate a fiscal contract. This recipe only creates a draft and does not issue the document.

  2. 2

    Select an existing customer and rule out an obvious duplicate

    It searches by tax id, email, phone, or name and keeps one verified existing cliente_id. This recipe does not create or correct contacts. It then lists that customer's invoices on the approved date, in pages of up to 30 records, and opens any candidate that matches the prepared document. Because there is no unique idempotency reference, it shows every reasonable candidate and stops for the operator to decide. It does not declare an unequivocal match by itself.

  3. 3

    Verify products, prices, taxes, and stock

    Every line starts from a reference or name resolved to an existing producto_id. The exact price lookup returns price lists and configured taxes with id, percentage, and status. The operator chooses the pre-tax unit price and exact impuestos_ids. It uses [] only after reviewing that the line carries no tax. When the item tracks inventory, it also reads stock by warehouse. A service without inventory is not presented as out of stock.

  4. 4

    Show every field and end the turn

    The Met shows cliente_id and name, account country and currency, explicit fecha and fecha_vencimiento in YYYY-MM-DD, and every producto_id with a positive quantity, precio_override before tax, and impuestos_ids. It also shows the operation's expected total and says Alegra will calculate the final total. The initial request does not approve this summary. Silence, a question, or an ambiguous answer leaves the draft uncreated.

  5. 5

    Create once and read the returned draft

    Only after a new, unambiguous yes does it call crear_pedido with confirmar as the literal boolean true. Missing, false, and the text "true" are rejected before any fetch. Empty products, empty ids, nonpositive quantities, missing or nonfinite prices, nonexplicit impuestos_ids, invalid dates, and a due date before the document date also fail before the network. confirmar never enters the body. Alegra receives status draft, the customer, dates, and approved lines. The Met opens the created id and reports only the returned number, status, total, and currency.

  6. 6

    Reconcile an uncertain response without repeating the POST

    The transport never retries POST /invoices, even after 429. When crear_pedido returns posiblemente_creada after a network failure or an HTTP 5xx response, preserving the status when available, the Met does not call the write again. It lists the customer's invoices on that date across every applicable page and opens candidates to compare dates, lines, and total. Even with no match, it hands the evidence to the operator for manual review in Alegra. A second attempt requires another human decision.

Before you start

What you need ready

The Met solves none of these for you. If one is missing, the automation stops there.

The limits

What this automation does NOT solve

Better said here than discovered halfway through the rollout.

FAQ

Questions about this automation

The initial request does not yet contain the summary that must be approved. The later message responds to the customer, dates, lines, prices, taxes, and expected total just shown by the Met. The handler requires confirmar as literal boolean true before any network request.

No. The tool fixes status to draft and calls no issuance, filing, or stamping endpoint. The operator continues the fiscal process in Alegra according to the country and account setup.

consultar_precio returns configured taxes with their ids. The operator approves the exact list and crear_pedido sends it as tax objects with id. The Met never infers taxes from a name, percentage, country, or product type.

No. Both must exist before the summary. If a record is missing or matches are ambiguous, the person creates or corrects it in Alegra and runs the lookups again.

The POST is not repeated. The recipe lists documents for the customer and date, opens candidates, and hands over the evidence. Even without a matching draft, another creation requires a fresh human decision after reviewing Alegra.

Keep going

Other automations built on the same tools

Want this automation running on your own data?

We will show it to you with your accounts connected, not with a canned demo.