SAP Business One Integration
How to Connect SAP Business One to NIVA — Complete Integration Guide
NIVA connects to SAP Business One using the Service Layer REST API, an OData-compatible HTTP interface included with SAP Business One 9.0+. Authentication uses a per-request session login — NIVA opens a session, executes the operation, and closes the session automatically. Once connected you can enable individual modules and control exactly which read and write operations your bot can perform.
What your bot can do after connecting
Business Partners
Customers, vendors and leads
- "Find all customers in London"
- "Show me details for customer C00001"
- "What is the balance for Acme Ltd?"
- "Create a new customer called Beta Corp"
- "Update the email for supplier S00010"
Sales Orders
Open and closed sales orders
- "Show all open orders for customer C00001"
- "What orders were created last week?"
- "Get full details of order DocEntry 1234"
- "Create an order for Acme Ltd — 2 units of item A00001 at £150 each"
Inventory
Items, stock levels and pricing
- "How many units of item A00001 do we have in stock?"
- "Search for all MacBook items"
- "Show stock for item A00001 in warehouse 01"
- "What items are currently out of stock?"
Invoices
A/R Invoices — open, overdue and paid
- "Show all open invoices for Acme Ltd"
- "List invoices due before 2024-03-31"
- "Get invoice DocEntry 5678"
- "Create an invoice for C00001 for 1 unit of service S00001 at £500"
Service Calls
Customer support and issue tracking
- "Show all high-priority open service calls"
- "Find service calls for customer C00001 from last month"
- "Get details of service call 42"
- "Create a service call for Acme: printer not working, high priority"
- "Close service call 42 with resolution note"
Before you begin
SAP Business One 9.0 or later (Service Layer must be installed and running)
Service Layer port accessible from NIVA server (default 50000/50001)
A SAP B1 user account with API access (not Windows/domain login)
Company database name (shown in SAP → Administration → Choose Company)
NIVA Botmaster account with active bot
Step-by-step setup
Verify Service Layer Is Running
- On your SAP server, open Services (services.msc) and confirm SAP Business One Service Layer is running.
- Open a browser on the same server and navigate to
http://localhost:50000/b1s/v1/$metadata— you should see XML metadata. - If using HTTPS (port 50001), test with
https://<host>:50001/b1s/v1/$metadata. - Ensure the SAP server's firewall allows inbound connections on port 50000 (or 50001) from your NIVA server's IP.
Service Layer is installed with SAP Business One Server Tools. If missing, re-run the SAP B1 installer and check the Service Layer component.
Gather Your Connection Details
- Note your SAP server hostname or IP address (e.g.
192.168.1.100orsap.mycompany.com). - Note the Service Layer port — default is
50000(HTTP) or50001(HTTPS). - Find your Company Database name: log in to SAP B1 → Help → About → or check Administration → Choose Company.
- Use a SAP B1 user login (not a Windows login). The "manager" account works but creating a dedicated API user is recommended.
Connect in NIVA Botmaster
- Go to Botmaster → ERP Integrations.
- Click Connect under SAP Business One.
- Enter: Server Host, Port, Company Database, Username, Password.
- Set Verify SSL to
falseif your SAP server uses a self-signed certificate (common for on-premise). - Click Save & Test — NIVA will attempt a login and fetch one record to confirm connectivity.
If the test fails with a connection error, check that the port is open and the hostname resolves from NIVA's server, not just locally.
Enable Components
- After connecting, click Manage Components.
- Toggle ON the components you want the bot to access (Business Partners, Sales Orders, Inventory, Invoices, Service Calls).
- For each component, review Read Operations (enabled by default) and Write Operations (disabled by default — enable only what you need).
- Click Save.
Start with read-only access. Enable write operations (create order, create invoice) only after testing read operations work correctly.
Test With Your Bot
- Open your bot's chat widget.
- Try: "How many units of [item code] do we have in stock?"
- Try: "Show me open orders for customer [CardCode]"
- Try: "Find service calls from last week"
- Check ERP Integrations → Operation Logs to see exactly which queries fired and their results.
Troubleshooting
Connection test fails with "Authentication failed".
Double-check Company Database name — it is case-sensitive and must match exactly. Verify the SAP username and password are for a SAP B1 user (not a Windows/AD login). Confirm the user is not locked out in SAP → Administration → Setup → General → Users.
Cannot connect to host — connection refused or timeout.
Confirm Service Layer is running on the SAP server (check Windows Services). Verify the port number — HTTP default is 50000, HTTPS is 50001. Check firewall rules on the SAP server allow the port inbound from your NIVA server. Test connectivity:
curl http://<host>:50000/b1s/v1/$metadataSSL certificate error.
Most on-premise SAP servers use self-signed certificates. Set Verify SSL to
false in the connection config. Alternatively, install a proper SSL certificate on the SAP server and set it to true.Bot returns "No items found" or empty results.
Check the component is enabled in Manage Components. Verify the SAP user has read access to that data in SAP → Administration → Setup → General → Users → Authorizations. Check Operation Logs to see the exact OData query sent and any SAP error returned.
Write operation fails with SAP error.
SAP Business One enforces mandatory fields — for example, Sales Orders require a valid
CardCode and at least one DocumentLine. Check the Operation Log for the specific SAP error message. Ensure the SAP user has the appropriate write permissions in SAP User Authorizations.Service Layer returns 400 on OData filter queries.
SAP Service Layer uses strict OData syntax. String values in filters must be single-quoted. Date fields use format
YYYY-MM-DD. Check Operation Logs to see the exact filter sent — report the error to NIVA support if the query looks malformed.Ready to connect SAP Business One?
NIVA Botmaster → ERP Integrations → Connect SAP Business One