ml-connector
SAP Business OneTwilio

SAP Business One and Twilio integration

SAP Business One manages procurement, finance, and inventory for small-to-midsize operations. Twilio sends time-sensitive notifications via SMS and voice. Together, they keep your team informed the moment a supplier invoice arrives, a payment is due, or critical inventory runs low. ml-connector monitors SAP Business One for these events and notifies your team through Twilio without re-keying or manual escalation.

How SAP Business One works

SAP Business One exposes business documents through OData v4 REST at a customer-specific Service Layer URL (default ports 50000 HTTP or 50001 HTTPS). Key entities include Invoices, PurchaseInvoices, PurchaseOrders, IncomingPayments, OutgoingPayments, JournalEntries, Items, and Dimensions. Authentication uses a session token obtained via POST to /Login, which returns a B1SESSION cookie valid for 30 minutes of inactivity; the token must be refreshed periodically. SAP Business One v10.0 FP 2602 and later support webhooks for Create, Update, and Delete events, but polling via scheduled GET with UpdateDate filters is the default. Each customer provides their own server URL; there is no global shared endpoint. OData queries support filtering, $expand for associations, and pagination via $top and $skip, though the default page size is 20 records.

How Twilio works

Twilio provides SMS, MMS, voice, and two-factor authentication through REST APIs at multiple sub-API endpoints: https://api.twilio.com/2010-04-01 for core messaging and calls, https://messaging.twilio.com/v1 for messaging services, https://verify.twilio.com/v2 for verification codes, and https://studio.twilio.com/v2 for workflow automation. Authentication uses HTTP Basic Auth with either Account SID and Auth Token or API Key SID and API Secret. Twilio accepts form-encoded request bodies and sends webhooks for incoming messages, message status callbacks (queued, sending, sent, delivered, undelivered, failed, read), call status updates (initiated, ringing, answered, completed), and verification events. Webhook validation uses HMAC-SHA1 signed with the Auth Token. Twilio regional endpoints with dublin.ie1 prefix support EU data residency requirements.

What moves between them

Monitoring flows from SAP Business One into Twilio. ml-connector polls SAP Business One on a scheduled cadence for newly created or updated invoices, purchase orders, overdue payments, and low inventory items. When these events are detected, ml-connector triggers SMS or voice notifications through Twilio to notify procurement, finance, and operations teams. The flow is one-directional: notifications originate in SAP Business One and are delivered through Twilio. Message status callbacks (delivery confirmation, failure, read receipts) flow back into SAP Business One as optional audit events, but no business data flows from Twilio back into SAP Business One.

How ml-connector handles it

ml-connector stores the SAP Business One Service Layer URL (unique per customer), Account SID, Auth Token, and target phone numbers encrypted. It maintains the B1SESSION token across requests and refreshes the session when a -5002 timeout error occurs, avoiding the cold-start latency of re-authenticating on every call. It polls SAP Business One via OData queries with UpdateDate filters to find new and modified invoices, purchase orders, and items since the last poll run, avoiding duplicate processing. When a threshold is crossed (invoice received, payment overdue by N days, stock below reorder point), ml-connector formats a notification message, looks up the appropriate phone numbers from a configuration table, and posts to Twilio's REST API with the message text and recipient list. For SMS delivery, it uses the core Messaging API; for voice alerts, it invokes the Voice API. Twilio returns a message SID for each notification; ml-connector logs the SID and message status for audit. Webhook signatures are validated using HMAC-SHA1 on callback delivery, and failure notifications (undelivered, failed) are logged as delivery exceptions. The integration handles SAP Business One's lack of guaranteed idempotency by checking for duplicate invoices via DocNum + InvoiceDate before processing.

A real-world example

A mid-sized distribution company uses SAP Business One for procurement and inventory. Their purchasing team is spread across three regional warehouses and often misses email notifications about supplier invoices and inventory reorder points. Before the integration, accounts payable struggled with late invoice processing and receiving teams did not know when to reorder until stock alerts surfaced in month-end reports. With SAP Business One connected to Twilio, the moment a purchase invoice arrives, the AP team gets an SMS alert; when inventory for a top SKU falls below the reorder point, a voice call notifies the warehouse manager. The team now processes invoices faster and prevents stockouts.

What you can do

  • Send SMS alerts when purchase invoices arrive in SAP Business One with supplier name and total amount.
  • Notify teams by voice call when a customer payment is overdue by N days, with the amount and due date.
  • Trigger reorder point alerts to warehouse staff when inventory quantities drop below configured thresholds.
  • Store and refresh the SAP Business One session token, and handle OData polling with UpdateDate filters to avoid duplicate notifications.
  • Log all SMS and voice delivery confirmations, failures, and read receipts as audit events in SAP Business One.

Questions

What business events in SAP Business One trigger notifications to Twilio?
ml-connector monitors purchase invoices, sales invoices, customer payments, and inventory levels in SAP Business One. Triggers are configurable thresholds such as new invoice receipt, payment overdue by N days, or inventory below reorder point. When a condition is met, ml-connector sends an SMS or voice notification to the designated team member or queue.
How does ml-connector handle SAP Business One's session token, which expires after 30 minutes of inactivity?
ml-connector reuses the session token across multiple API calls to minimize authentication overhead. When a -5002 timeout error is returned, indicating the token has expired, ml-connector automatically refreshes the session by posting to /Login again and storing the new B1SESSION cookie. No manual re-authentication is required.
Does the integration support Twilio's EU data residency option?
Yes. ml-connector can be configured to use Twilio's dublin.ie1 regional endpoints for EU data residency compliance. This ensures message delivery occurs within the EU and audit logs are stored in EU data centers when required by local regulation.

Related integrations

Connect SAP Business One and Twilio

Free to use. Add your credentials, ping your real systems, and see if we fit.

Get started