Two calls take a customer from Odoo to the Maihue customer portal:
create provisions the account, its logins (without a password) and an
open onboarding; invite sends the email with the link that starts the
onboarding. Creating never sends an email, so Odoo decides when the
customer is contacted.
Flow
1
Create the customer
POST /maihue/onboarding with the customer data. Horizon creates or
updates the account and its users and opens the onboarding of the
business unit (home, horeca or business). Store
data.account and data.onboarding.document_id on the Odoo record.2
Send the invitation
POST /maihue/onboarding/{document_id}/invite. Horizon emails the
recipient “Activa tu cuenta Maihue” with a link valid for 24 hours.3
The customer completes the onboarding
In the portal the customer accepts the terms, validates their identity,
confirms a payment method and sets a password. The onboarding moves
created → invited → in_progress → completed.4
Follow the progress (optional)
GET /maihue/onboarding/{document_id} returns the status and the
steps.Before you start
The key is created with
POST /permission/api-key
and its permissions with POST /permission/api-key-permission.
Both require platform permissions, so the platform team runs them and
hands the key to the Odoo team through a secret channel. Rotation
(rotate) invalidates the old
key at once: update Odoo in the same window.1. Create the customer
POST /maihue/onboarding (reference).
Catalog fields take stable codes, so the same payload works in every
environment.
Field mapping
Request
Response
201 when the account was created, 200 when it already existed and was
updated. Both carry the same body:
2. Send the invitation
By onboarding id (recommended)
POST /maihue/onboarding/{document_id}/invite, no body
(reference).
By RUT
When Odoo did not keep the onboarding id,POST /maihue/onboarding/send-email
finds the account by RUT (reference).
Here type is the account type, not the business unit: home →
person, horeca and business → company. The business unit goes in
business_unit.
email (optional) picks the recipient and must be the primary_user or
legal_representative; force: true sends again even when an invitation is
live, at most once per minute.
Result
The email link is valid for 24 hours. To send a new one, call
POST /maihue/onboarding/{document_id}/resend
(at most once per minute).
3. Follow the progress
GET /maihue/onboarding/{document_id} (reference)
returns the onboarding with its status.internal and its steps.
A terminal status frees the business unit: the next create opens a new
onboarding.
Horizon has no “onboarding completed” event an external system can
subscribe to yet. Poll the open onboardings (for example once a day, well
within the rate limit) until they reach a terminal status.
Outbound webhooks publish
maihue-onboarding.*
events for the onboarding API calls (create, invite, send-email, resend,
cancel), not for the customer’s progress in the portal.Errors and retries
Every error answerserror.errors with the reason and meta.correlation;
quote the correlation when reporting an issue to the platform team.
Retrying is safe. The create is idempotent by
dni + type + type_dni:
the same customer sent twice answers 200 Updated and the same onboarding,
never a duplicate. The invite answers already_sent while an invitation is
live. A create that fails midway rolls back what it created.
Example: Odoo server action
x_horizon_account and x_horizon_onboarding are example custom fields on
res.partner; use whatever fields the Odoo module defines.
Go-live checklist
- API key per environment with
maihue-onboarding:create,maihue-onboarding:invite(andmaihue-onboarding:find-one), stored in Odoo’s system parameters. -
portal-customer-onboardingon in the target environment. - One home and one company customer created and invited in certification; both emails received and both onboardings completed in the portal.
- Odoo stores
data.accountanddata.onboarding.document_id, and retries429,503and5xxwith backoff. - A re-sent customer answers
200with the same onboarding.