How integrations work
What an integration is in Hydda One, the calls it makes, and how an organization installs and configures it.
Hydda One hands some jobs to a system outside it. It builds an invoice, but an ERP issues it. It writes a contract, but a signing service collects the signatures. An integration is the system that does one of these jobs for an organization.
To Hydda One, an integration is an API client: a client id and a client secret that an administrator has tied to one job. An invoicing integration makes these calls:
| Call | What it is for | |
|---|---|---|
| 1 | POST /oauth/token |
Get an access token. |
| 2 | GET /v1/integrations/configurations |
Read where the organization switched it on. |
| 3 | POST /v1/integrations/configurations/{configurationId}/ready |
Say that it works there. |
| 4 | GET /v1/billing/send-queue |
Read the work that waits. |
| 5 | POST /v1/billing/batch/report-sent |
Report what it did. |
Build your own integration walks through each one, with a worker you can start from.
Integration points
A job that an integration can take over is called an integration point. There are two:
| Integration point | Name in the admin console | The job | Filled |
|---|---|---|---|
billing.invoicing |
Invoicing | Issue each approved invoice, deliver it, and report payments. Optionally review each invoice before it is created. | Once for the whole organization. |
crm.signing |
Contract signing | Send each contract for signature, and report how the signing ends. | Once for each business context. |
A point takes one integration at a time. An organization has one invoicing integration. Each business context has one signing integration, and two business contexts can use different ones.
Until an integration fills a point, the work waits. Approved invoices stay approved, and operators cannot send contracts for signature.
The parts of an integration
| Part | What it is | Who changes it |
|---|---|---|
| Integration | Its name, the integration point it fills, and its capabilities there. | An administrator, in the admin console. |
| Installation | The integration inside one organization. It can be disabled, enabled again or uninstalled. | An administrator. |
| Configuration | Switches the integration on in one place: the whole organization, or one business context. | An administrator saves it. Your integration reports its status. |
A capability is a part of the job. Invoicing has two: sending, which every invoicing integration has, and basisVerification, the optional review of each invoice before it is created.
Your integration only ever sees its configurations. An invoicing integration has one:
{
"id": "0b9f3c1e-5a4d-4c2b-8e7f-6a5b4c3d2e1f",
"operationalContextId": "7d1e2f3a-4b5c-4d6e-8f70-1a2b3c4d5e6f",
"level": "organization",
"values": {},
"secrets": {},
"status": "pending"
}
| Integration point | level of the configuration that fills it |
Role the integration needs there |
|---|---|---|
billing.invoicing |
organization. One configuration. |
Billing Integration, at the organization. |
crm.signing |
business_context. One for each business context that signs. |
Signing Integration, at that business context. |
One invoicing integration serves every business context of the organization. Each invoice names the business context it belongs to, and the integration picks the right ERP account from it. See the company an invoice belongs to.
The integration says when it is ready
An administrator can save a configuration, but only the integration knows whether it can reach the ERP. So the integration sets the status:
# It works
curl -X POST "https://api.hydda.one/v1/integrations/configurations/$CONFIGURATION_ID/ready" \
-H "Authorization: Bearer $ACCESS_TOKEN"
# It does not
curl -X POST "https://api.hydda.one/v1/integrations/configurations/$CONFIGURATION_ID/failed" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "code": "erp_unreachable", "reason": "The ERP did not answer." }'
Hydda One starts to use an integration only when its configuration is ready. Until then the billing queues answer 400 with BILLING_INTEGRATION_NOT_CONFIGURED, and operators cannot send contracts for signature in that business context.
The Integrations API guide has the details of these calls.
Nobody calls your integration
Hydda One never calls an integration. There is no webhook and no callback address to register. An integration polls queues for work and reports the outcomes, up to 200 in one request.
So an integration needs no public address, no inbound firewall rule and no signature check. If it is down for an hour, the work is still on the queue when it comes back.
Connectors from Hydda
Hydda runs integrations of its own for some providers: Payer for invoicing, and Scrive for contract signing. The admin console marks them Hydda, and an integration you build Your own.
A connector calls the same API as your integration and fills the same integration points. A point takes one integration at a time, so an administrator removes a connector before yours can take its place. See Take over from a connector.
Three things in these guides apply to connectors only. Skip them when you build your own:
| For connectors only | Where it comes up | What you do instead |
|---|---|---|
| The installation-token grant, signed with the connector’s private key. | Authentication | Use client_credentials with your client id and secret. |
Fields in values and secrets, from a form the connector defines. |
Integrations API | Both are empty. Keep your settings in your own system. |
| A role that Hydda One grants when an administrator saves the settings. | Roles | An administrator assigns the role to your integration’s application. |