ml-connector
FreshBooksMicrosoft Teams

FreshBooks and Microsoft Teams integration

FreshBooks tracks your accounting: invoices, expenses, bills, and clients. Microsoft Teams is where your team communicates. Connecting the two sends invoice and bill events directly into Teams channels, so finance approvers and managers see what they need to act on without leaving their chat workspace. ml-connector handles the user-delegated OAuth that FreshBooks requires and the app-only Entra ID authentication that Teams demands, along with the different webhook expiry rules each platform enforces.

How FreshBooks works

FreshBooks exposes clients, invoices, bills, expenses, payments, and chart of accounts through REST APIs under the /accounting/account and /timetracking namespaces. Authentication is OAuth 2.0 Authorization Code grant with user-delegated tokens, not Client Credentials, so access is tied to a specific FreshBooks user. FreshBooks delivers updates through webhooks to a customer-supplied endpoint, with event types for invoice, bill, payment, and expense create, update, and delete actions. Webhook payloads are signed with HMAC-SHA256 and include object_id, account_id, and event metadata. Webhook delivery can range from seconds to several minutes and has a 10-second timeout per attempt.

How Microsoft Teams works

Microsoft Teams is accessed through Microsoft Graph REST API, not a standalone Teams API. The Graph supports OAuth 2.0 Client Credentials flow for app-only (daemon) authentication, requiring tenant_id, client_id, and client_secret. Microsoft Graph offers change notifications via subscriptions: you POST to /subscriptions to register a webhook URL for resource changes. Subscriptions expire after 3 days (shorter for presence and shifts) and must be renewed before expiry. Webhook validation requires returning a validationToken within 10 seconds, and rich notifications use customer-supplied public key encryption. An Azure AD tenant is limited to 10,000 active Teams subscriptions total.

What moves between them

FreshBooks invoices, bills, and payments flow into Microsoft Teams channels in near real-time via FreshBooks webhooks. When an invoice is created, updated, or deleted in FreshBooks, ml-connector formats the event and sends a message to a pre-configured Teams channel. Bill and payment events follow the same pattern. The flow is read-only from Teams perspective: Teams receives notifications but does not write back into FreshBooks.

How ml-connector handles it

ml-connector stores FreshBooks user OAuth tokens encrypted and refreshes them before expiry. On the Teams side, it authenticates as a daemon app using Entra ID Client Credentials, obtaining an access token to call the Microsoft Graph API. FreshBooks webhooks are validated by comparing the HMAC-SHA256 signature in the X-FreshBooks-Hmac-SHA256 header against the payload. Microsoft Graph change notifications are validated by matching the clientState field in the subscription. Because FreshBooks webhooks can be slow (seconds to minutes) and Microsoft Graph subscriptions expire in 3 days, ml-connector tracks subscription expiry and renews before the deadline to avoid losing notifications. Each webhook event is logged with a full audit trail, including the raw event, the formatted Teams message, and the Graph response, so failed sends can be retried.

A real-world example

A small-to-mid-sized professional services firm runs FreshBooks for accounting and uses Microsoft Teams for team collaboration. The finance manager currently checks FreshBooks every morning to see new invoices and bills, then manually posts status updates to the finance channel so that project managers and executives know what is pending. When an invoice goes unpaid beyond terms or a vendor bill arrives, important deadlines slip because the notification is buried in chat or missed entirely. By connecting FreshBooks and Teams, invoice and bill events post automatically to the finance channel in a structured format. The team sees new invoices within minutes of creation, project managers are notified of bills related to their projects, and payment due dates are visible in the channel history. The manual morning check becomes unnecessary, and critical dates are harder to miss.

What you can do

  • Push FreshBooks invoice, bill, and payment events to Microsoft Teams channels as formatted messages.
  • Validate FreshBooks HMAC-SHA256 webhook signatures and Teams clientState subscription metadata.
  • Authenticate with FreshBooks user-delegated OAuth tokens and refresh them automatically.
  • Use Microsoft Entra ID Client Credentials to access Microsoft Graph as a daemon app.
  • Track Microsoft Graph subscription expiry and renew subscriptions before they expire to avoid losing notifications.

Questions

Does the integration write data back from Teams into FreshBooks?
No. The integration is unidirectional: FreshBooks events are sent to Teams as notifications. Teams does not write back to FreshBooks. The flow delivers accounting updates to your team communication channel, not a full bidirectional sync.
How does ml-connector handle the difference in how FreshBooks and Teams validate webhooks?
FreshBooks uses HMAC-SHA256 signatures via the X-FreshBooks-Hmac-SHA256 header. Microsoft Graph uses clientState matching and validationToken handshakes. ml-connector validates each system's signature method independently: it compares the FreshBooks HMAC to the payload, and it matches the Microsoft Graph clientState to the subscription record to confirm the notification is authentic.
Why do Microsoft Graph subscriptions need renewal, and how does ml-connector handle it?
Microsoft Graph subscriptions expire in 3 days by default (shorter for presence and shifts). If a subscription expires, ml-connector will stop receiving notifications. ml-connector tracks subscription creation and expiry time, renews the subscription at least one day before expiry, and logs each renewal so you can monitor the subscription lifecycle.

Related integrations

Connect FreshBooks and Microsoft Teams

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

Get started