Dograh

How to Connect a Voice Agent to Your ERP Through a Middle Layer

How to Connect a Voice Agent to Your ERP Through a Middle Layer
TutorialDecember 4, 2026·10 min read

How to Connect a Voice Agent to Your ERP Through a Middle Layer

Abhishek Kumar
Abhishek Kumar·Co-founder, Dograh AI

Co-founder of Dograh, building the future of open-source voice AI agents. Own your voice AI stack.

To connect a voice agent to your ERP, call a thin middle layer from HTTP API tools. The layer holds the ERP credential, checks the caller and returns only the fields the agent needs. Dograh, the open-source AI voice agent platform, runs those tools, whether you self-host it or use Dograh Cloud.

Key Takeaways

  • The agent reads the whole tool reply, so the middle layer sends only four fields.
  • Verify the account in the layer, so stored values never reach the agent.
  • Self-hosted Dograh can call a middle layer on a private network address.

ERP records are built for screens, and a caller needs only a few fields. Here we connect a voice agent to your ERP through a thin middle layer, step by step, in Dograh, our open-source AI voice agent platform. Then we cover verification, fallbacks and where each part runs.

What you need before you start

These steps follow the published Dograh docs and the ERP vendors' API docs. Run them on a trial server before production, against a sandbox or test company in your ERP, so a wrong field never reaches a real customer.

The agent reaches the ERP over plain API calls. Pre-Call Data Fetch runs as the call starts, HTTP API tools run during it and the Webhook node runs after it, and each one calls an endpoint you run, the middle layer. Only the layer talks to the ERP. That holds for Business Central, NetSuite, Odoo, SAP or another ERP, because the voice side never sees which one sits behind the layer.

You need API access to your ERP with a read-only role, a place to run a small service near the ERP, and an agent with a node that answers order questions. What the agent should say on an order desk call, from PO status to credit holds, is covered in our post on AI voice agents for manufacturers and distributors. This post is about the plumbing underneath it.

Some calls need more than the ERP. Parloa suggests that the order system answers most status questions and the ERP answers stock and backorder dates. If your status lives in a separate order or shipping system, the layer can ask both and still send one short answer.

Step 1: Decide the lookups and their fields

Write the field list before any code, because it decides what the agent can ever say. Start with three lookups, order status, stock for one item and a short account summary. For each one, list the fields a caller needs to hear and nothing more.

ERP records are far bigger than that. A Business Central sales order carries about 50 properties, including the sell-to, bill-to and ship-to addresses, a phone number, an email and the totals. The agent needs four of them, number, status, fullyShipped and requestedDeliveryDate. Everything else stays in the layer.

Stock follows the same rule. A Business Central item has inventory, the units in stock, next to unitPrice and unitCost. The caller may hear the item name and the stock figure. unitCost never leaves the layer, and prices only after the caller is verified and only if your desk quotes prices by phone.

Check: you have a written list of fields per lookup, and none of them is an address, a cost or a field the caller did not ask about.

Step 2: Build the thin middle layer

The middle layer is a small service with four jobs, and each one keeps the agent's prompt short and safe. It holds the ERP credential, calls the ERP, trims the record to your field list and turns codes into words. It also answers within a time budget you set, so a slow ERP never leaves the caller in silence.

The credential depends on the ERP. NetSuite offers an OAuth 2.0 client credentials grant for machine-to-machine access, mapped to an entity, a role and an uploaded certificate. Each integration record, entity and role can hold at most five active certificates, and a sandbox refresh clears the setup. Odoo's JSON-2 API takes a bearer API key at /json/2/<model>/<method>, and Odoo has scheduled XML-RPC and JSON-RPC for removal in Odoo 22 (fall 2028) and Odoo Online 21.1 (winter 2027), so new layers should start on JSON-2. For Business Central and others, use the ERP's own sign-in and keep the token refresh inside the layer.

Codes need the most care. Business Central's sales order status is a document state such as "Open", not a shipping state, so the layer reads it together with fullyShipped and writes one sentence. Here is a sample answer we wrote for one order:

{
  "order": "SO-10482",
  "status": "open",
  "shipped": "partly",
  "requested_date": "2026-12-11",
  "say": "Order SO-10482 is open. Part of it has shipped, and the requested delivery date is December 11."
}

What this does: It gives the agent four facts and a finished sentence, with no amounts, addresses or contact details. The agent reads say, so every caller with the same order hears the same answer.

Older ERPs without a usable API are not a dead end. The layer can read a database view or a scheduled export instead, and the voice side stays the same. Our Shopify post uses the same layer pattern for a store's short-lived token.

Check: the layer answers each lookup within its budget, in the shape above, for a test order and a test item.

Step 3: Verify the caller in the layer

A phone number finds an account, but it does not prove who is calling. Pre-Call Data Fetch, at the bottom of the Start Call node, sends a POST with the caller's details to an endpoint you run. The layer looks up the account by from_number and returns only account_found and a short label, with no amounts and no order details.

Before any order, stock reserved for the account or balance is named, the agent runs a verify_account tool. It sends the account number and a second fact the caller should know, such as the ZIP code on file or a recent PO number. The layer compares them itself and answers with verified true or false, and never returns the stored value, so the agent cannot read it out by mistake.

The prompt carries the order of events. "Greet the caller, then ask for the account number and the ZIP code on file and call verify_account. Name no order, stock reservation or amount until it returns verified true. After two failed tries, offer a callback request." Public stock questions, such as whether an item is in stock at all, can be answered before this step if your desk already shares that freely.

Check: a test call with a wrong second fact hears no account details, and the Pre-Call Data Fetch reply holds only the two short fields.

Dograh

Open Source Alternative to Vapi / Retell

Self-hosted voice agent platform — no per-minute fees

dograh-hq/dograh

Star on GitHub

Step 4: Add the read tools in Dograh

Each lookup becomes one HTTP API tool that points at the layer, never at the ERP. Store the layer's own secret once under Credentials as a Bearer Token, then create get_order_status and get_stock under Tools as External HTTP API tools, with POST, the layer's address as the Endpoint URL and that credential on the Authentication tab. Our logistics tutorial walks through the tool screens one by one.

The agent receives the whole reply as data, with a status of success or error, and nothing filters it on the way. That is the reason the layer exists. Whatever the layer returns, the model reads, so the four-field answer from Step 2 is also your privacy control. The HTTP API tool page shows the reply format.

Set Timeout (ms) from the layer's budget. It starts at 5,000 and goes up to 30,000, but a caller notices silence long before that. In our experience a lookup on a database next to the agent fits inside a normal turn, while a third-party ERP API often does not, so slow lookups get a filler line and a hard ceiling. In the tool's Messages, add a line under "When the tool starts", such as "Let me check that order", and one under "While the tool is running" after about 3 seconds.

Check: each tool's test run returns the layer's short answer, and a deliberately slow layer triggers the second Messages line.

Step 5: Give every failure a spoken answer

The ERP will be slow or down at some point, and the caller should hear a plain sentence when it is. HTTP API tools do not retry on their own, so a timeout or error reaches the agent once as status: error. The prompt then apologizes once, offers a callback request and never guesses an order status.

Stock needs its own rule, because a guess here turns into a broken promise. The layer can keep a short stock cache, with figures a few minutes old at most. When the ERP does not answer in time, the layer returns the last figure with its age, such as "about 120 as of 4 minutes ago", or "unknown" when the cache is too old. It never returns a guess.

An ERP server rack with an hourglass is slow or down, and the middle layer's request to it gets no answer in time. The middle layer holds a note reading about 120 as of 4 minutes ago, and another reading unknown when the cache is too old. The first figure goes to the AI agent, who is on a call with a buyer asking about stock.
A stock count spoken on a call works like a promise to the buyer, so an old figure has to say how old it is. Once the saved count is too stale, the honest answer is unknown rather than a number.

Hand-offs need tools as well. A third HTTP API tool writes a callback request to your CRM or helpdesk through the layer. On Twilio, Telnyx, Plivo, Cloudonix and Asterisk ARI numbers, Transfer Call can pass the caller to inside sales. Dograh calls the destination first and connects the caller only when someone answers.

Lock the layer down too. Each endpoint should do one narrow job and check the stored credential on every request, as our post on securing tool calls and webhooks explains.

Check: with the ERP sandbox stopped, a test call hears the sorry line and a callback offer, and a stock question gets a figure with its age or "unknown".

Join the Dograh Community

Dograh is an OSS alternative to Vapi. Join our Slack community for queries, releases, best practices & community interactions.

Step 6: Log the call after it ends

Write to the ERP or CRM after the call, not during it, unless a caller action truly needs a live write. Reads during the call and one write afterwards keep the call simple and every write in one place. A Webhook node posts the outcome to the layer once the call ends, and the layer decides what to write where.

The Webhook node adds a call_disposition key to the payload, retries temporary failures up to five attempts in all, and also fires on calls nobody answered. Have the layer skip repeats by workflow_run_id, so a retried delivery never logs the same call twice.

Check: after a test call, the layer logs one entry per call ID, and a no-answer call shows up with its status.

Testing it and choosing where it runs

Test the whole path on the sandbox before real buyers call it. Run a verified status call, a wrong second fact, a stock question with the ERP stopped and an order number that does not exist. Then call from a real phone, because account numbers are harder to catch on a phone line, and open View Trace to see how long each tool took.

Where the agent runs decides where the layer may live. Self-host Dograh inside your network and its tools can call a middle layer on a private address, next to the ERP. On Dograh Cloud, give the middle layer a public HTTPS address, and keep its secret check strict.

Self-hosting also changes the bill and the upkeep. When you self-host Dograh there is no per-minute platform fee, but servers, model keys and phone minutes still cost money, and your team looks after the database and upgrades, as it already does for the layer. Dograh Cloud charges a 1¢-a-minute platform fee and runs the platform side for you.

Glossary

Middle layer
A small service between the voice agent and the ERP that holds the ERP credential, checks the caller and returns only the fields the agent may say.
Field list
The written list of fields each lookup may return. Anything not on it, such as addresses or unit cost, stays inside the middle layer.
Stock cache
A short-lived copy of stock figures kept in the middle layer. Each figure goes out with its age, so the agent says when the count was taken.
Time budget
The longest the middle layer waits on the ERP before it answers with a fallback, kept below the tool's Timeout (ms) so the caller never hears silence.

Frequently Asked Questions

Get started with Dograh

Build, deploy, and scale AI agents with Dograh. Join the community of developers building the future.