ml-connector
FreshBooksServiceNow

FreshBooks and ServiceNow integration

FreshBooks handles invoicing, expense tracking, and vendor payments for small business accounting. ServiceNow Source-to-Pay operations run Accounts Payable and procurement for mid-market enterprises. Connecting them keeps your AP backlog in sync with FreshBooks financials. Vendor invoices created in FreshBooks flow into ServiceNow's AP module without re-keying, vendor master records stay aligned, and the audit trail tracks every step.

How FreshBooks works

FreshBooks is a REST API cloud platform that exposes invoices, bills, bill vendors, clients, payments, expenses, chart of accounts, and journal entries. It uses OAuth 2.0 user-delegated Authorization Code flow, so FreshBooks access is tied to an authorized user rather than a service account. The platform pushes events via webhooks to a customer-supplied endpoint whenever invoices, bills, vendors, clients, expenses, or payments change. Webhook payloads arrive as application/x-www-form-urlencoded data signed with HMAC-SHA256 via the X-FreshBooks-Hmac-SHA256 header. Webhook delivery is not real-time and can range from seconds to several minutes, and a webhook timeout of 10 seconds or non-2xx response will trigger retries that eventually disable the callback if failures persist.

How ServiceNow works

ServiceNow is a cloud platform with isolated per-customer instances, each accessed at a unique subdomain. The Source-to-Pay operations module includes Accounts Payable, Procurement, and Supplier Lifecycle Management exposed through REST APIs with JSON responses. Authentication uses OAuth 2.0 Client Credentials for machine-to-machine access (recommended) or Basic Auth with username and password. The ServiceNow Table API supports both read and write operations across tables like sn_apo_invoice, proc_po, sn_s2p_supplier_inbound_staging, and core_company. ServiceNow does not offer native outbound webhooks; data flows are pull-based polling on a schedule you define, with optional Business Rules and Outbound REST Messages for real-time push if configured by an admin. AP and S2P operations require module licensing and appropriate user roles.

What moves between them

The main flow is FreshBooks into ServiceNow. When a bill or invoice is created or updated in FreshBooks, the webhook fires to ml-connector, which maps the bill header and line items to ServiceNow's Accounts Payable staging tables (sn_apo_invoice and related tables). Vendor records are synced from FreshBooks bill vendors into ServiceNow's supplier master (core_company). The integration aligns vendor names, tax IDs, and payment terms so incoming bills match the correct supplier. GL account mappings ensure bill line items post to the right cost center in ServiceNow. Payments made in FreshBooks can also be synced to close AP records in ServiceNow if configured.

How ml-connector handles it

ml-connector registers a webhook endpoint with FreshBooks, signed with your FreshBooks account API key and secret. When FreshBooks fires an invoice or bill event, ml-connector verifies the HMAC-SHA256 signature and unmarshals the payload. It then looks up the matching vendor in ServiceNow using bill_vendor.accountid and vendor_name as search keys, creates or updates a record in the sn_apo_invoice staging table with bill amount, due date, line-item detail, and GL account mappings, and performs a write via the ServiceNow Table API using OAuth 2.0 Client Credentials or Basic Auth. FreshBooks uses user-delegated OAuth, so the integration stores one user's refresh token and extends it as needed. ServiceNow's token lifespan is 30 minutes by default, so ml-connector tracks expiry and refreshes before each call. Line items are mapped to cost centers and GL accounts based on configuration rules you set per bill vendor or category. If a FreshBooks webhook times out or fails, it will retry on FreshBooks' schedule; ml-connector idempotently updates the same AP record using the bill ID as a unique key. A full audit log tracks every webhook received, every API call made to ServiceNow, and every mapping decision.

A real-world example

A mid-market services firm uses FreshBooks to manage client invoicing and vendor bills for contractors, consultants, and software subscriptions. The finance team tracks expenses and enters vendor invoices by hand into ServiceNow's AP module at month-end close, leading to delays, duplicate entries, and reconciliation headaches. With FreshBooks and ServiceNow connected, vendor bills created in FreshBooks automatically land in ServiceNow's AP staging tables mapped to the correct GL accounts and cost centers. The AP team can review and approve bills in ServiceNow without re-entry. Vendor master records stay synchronized, so a new vendor added in FreshBooks appears in ServiceNow's supplier list ready for PO creation. Month-end close starts with AP already loaded and validated, cutting manual entry time by 60 percent and eliminating duplicate-invoice risk.

What you can do

  • Receive FreshBooks invoice and bill webhooks and map them to ServiceNow Accounts Payable staging tables with full line-item detail.
  • Sync FreshBooks bill vendors into ServiceNow's supplier master (core_company) so new vendors are available for procurement immediately.
  • Align GL accounts and cost centers between FreshBooks expense categories and ServiceNow finance dimensions, so AP entries post to the correct GL account.
  • Authenticate FreshBooks with OAuth 2.0 user-delegated access and ServiceNow with OAuth 2.0 Client Credentials or Basic Auth, managing token refresh automatically.
  • Track every webhook ingestion, every AP write, and every vendor sync in a full audit log with replay capability if a downstream write fails.

Questions

Does the integration work with both FreshBooks invoices and bills, or just one?
The integration handles both. FreshBooks invoices represent money you are owed; bills represent money you owe to vendors. ml-connector ingests bill and bill_vendor events via webhook and maps them into ServiceNow's AP module. Invoices can also be synced if you want to track expected revenue in ServiceNow, but the primary use case is bill-to-AP. The webhook event types and filters are configurable per customer.
How does ml-connector handle FreshBooks user-delegated OAuth and ServiceNow Client Credentials at the same time?
ml-connector stores the FreshBooks user's OAuth token (obtained during initial setup via Authorization Code flow) and refreshes it when it expires. For ServiceNow, it uses OAuth 2.0 Client Credentials (application ID and secret) or falls back to Basic Auth if you prefer. Each system's credentials are encrypted separately and rotated independently, so a token renewal on one side does not affect the other. The integration tracks both expiry times and refreshes before they cause a call to fail.
What happens if a vendor in FreshBooks does not exist in ServiceNow, or a GL account mapping is missing?
ml-connector will not create an AP record if the vendor or GL account is not found. Instead, it logs the missing reference in the audit trail and pauses the record for manual review. You can configure a fallback vendor (e.g., a suspense AP vendor) and a default GL account so that unmatched bills do not block the flow, but the audit log always flags the mismatch so you can resolve it later. This prevents silent posting to wrong accounts.

Related integrations

Connect FreshBooks and ServiceNow

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

Get started