Setting Up Integrations #
Preview Environments can connect to external services like Xero, QuickBooks Online (QBO), SharePoint, and more. This guide shows you how to configure these integrations for testing.
Overview #
Unlike production environments where integrations are pre-configured, Preview Environments require manual setup for OAuth-based integrations. This is because:
- 🔐 Each OAuth integration requires a unique callback URL
- 🌐 Preview URLs are dynamically generated per PR
- 🔒 Security best practices prevent automatic OAuth configuration
General Integration Setup Process #
The basic process for all OAuth integrations:
┌─────────────────────────────────────────────────────────────┐
│ 1. Get your Preview Environment URL │
│ Example: https://app-preview--coder-preview-123--john...│
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ 2. Contact a developer with integration admin access │
│ Provide: Preview URL + Integration type │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ 3. Developer updates OAuth callback URL │
│ In integration provider's developer portal │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ 4. Test OAuth flow in Preview Environment │
│ Connect organization → Authorize → Verify connection │
└─────────────────────────────────────────────────────────────┘
Supported Integrations #
| Integration | Type | OAuth Required | Configuration Complexity |
|---|---|---|---|
| Xero | Accounting | Yes | Medium |
| QuickBooks Online (QBO) | Accounting | Yes | Medium |
| SharePoint | Document Storage | Yes | Medium |
| Googole Drive | Document Storage | Yes | Medium |
| Intercom | Customer Support | Webhook | Low |
| Stripe | Payment Processing | API Key | Low |
Xero Integration Setup #
What You’ll Need #
- Preview Environment URL
- Xero Developer account access (contact developer)
- Test Xero organization
Step-by-Step Process #
1. Get Your Preview URL #
From your PR comments, copy the full preview URL:
https://app--preview--coder-preview-<PR number>--john.coder.internal.gotofu.com/
2. Update Xero OAuth Settings #
The developer will:
- Go to Tofu-local configuration page
- Add redirect URI in Configuration:
https://app--preview--coder-preview-<PR number>--john.coder.internal.gotofu.com/api/v1/integrations/oauth/authorize/callback - Save changes
⏱️ Wait Time: Changes are effective immediately
3. Connect Xero in Preview Environment #
- Access your Preview Environment
- Navigate to Settings → Integrations
- Find Xero in the integrations list
- Click “Connect”
- You’ll be redirected to Xero’s authorization page
- Sign in with your Xero test account
- Select the test organization
- Click “Allow access”
- You’ll be redirected back to BonsAI
- Verify connection status shows “Connected”
4. Test the Integration #
# Trigger a sync
Settings → Integrations → Xero → "Sync Now"
# Verify data sync
Navigate to Invoices → Check for synced data
# Check sync logs
Settings → Integrations → Xero → "View Logs"
Troubleshooting Xero #
Error: “Invalid Redirect URI”
- Cause: OAuth redirect URL not configured
- Solution: Verify developer has added the correct redirect URI
Error: “Organization Not Found”
- Cause: Connected to wrong Xero organization
- Solution: Disconnect and reconnect, selecting correct org
QuickBooks Online (QBO) Setup #
What You’ll Need #
- Preview Environment URL
- QuickBooks Online Developer account access
- QBO Sandbox account
Step-by-Step Process #
1. Get Your Preview URL #
Copy from PR comments:
https://app--preview--coder-preview-<PR number>--john.coder.internal.gotofu.com/
2. Update QBO OAuth Settings #
The developer will:
- Go to Tofu Local Settings page
- Navigate to Redirect URIs
- Add redirect URI:
https://app--preview--coder-preview-<PR number>--john.coder.internal.gotofu.com/api/v1/integrations/oauth/authorize/callback - Save changes
⏱️ Wait Time: Changes are effective immediately
3. Connect QBO in Preview Environment #
- Access your Preview Environment
- Go to Settings → Integrations
- Find QuickBooks Online
- Click “Connect”
- Sign in to QuickBooks
- Select your sandbox company
- Click “Authorize”
- Verify connection in BonsAI
4. Test the Integration #
# Trigger a sync
Settings → Integrations → QuickBooks → "Sync Now"
# Verify customers synced
Navigate to Customers → Check for QBO data
# Verify invoices synced
Navigate to Invoices → Check for QBO invoices
# Check sync status
Settings → Integrations → QuickBooks → "View Activity"
Troubleshooting QBO #
Error: “Redirect URI Mismatch”
- Cause: OAuth redirect not properly configured
- Solution: Verify exact URL match including trailing slashes
SharePoint Integration Setup #
What You’ll Need #
- Preview Environment URL
- Microsoft Entra ID access
- Test SharePoint site
Step-by-Step Process #
1. Get Your Preview URL #
Copy from PR comments:
https://app--preview--coder-preview-<PR number>--john.coder.internal.gotofu.com/
2. Update Entra ID #
- Go to Tofu Integration Dev Authentication page
- Add redirect URI:
https://app--preview--coder-preview-<PR number>--john.coder.internal.gotofu.com/api/v1/integrations/oauth/authorize/callback - Save changes
⏱️ Wait Time: Up to 5 minutes for changes to propagate
3. Connect SharePoint #
- Access Preview Environment
- Go to Settings → Integrations
- Find SharePoint
- Click “Connect”
- Sign in with Microsoft account
- Select the SharePoint site
- Grant permissions
- Verify connection
Troubleshooting SharePoint #
Error: “AADSTS50011: Redirect URI Mismatch”
- Cause: Azure AD redirect URI not configured
- Solution: Verify developer has added exact URI
Google Drive Integration Setup #
What You’ll Need #
- Preview Environment URL
- GCP access
Step-by-Step Process #
1. Get Your Preview URL #
Copy from PR comments:
https://app--preview--coder-preview-<PR number>--john.coder.internal.gotofu.com/
2. Update Google Drive App #
- Go to Integration Dev Clients page
- Add redirect URI:
https://app--preview--coder-preview-<PR number>--john.coder.internal.gotofu.com/api/v1/integrations/oauth/authorize/callback - Save changes
⏱️ Wait Time: Up to 5 minutes for changes to propagate
3. Connect SharePoint #
- Access Preview Environment
- Go to Settings → Integrations
- Find Google Drive
- Click “Connect”
- Sign in with Google account
- Select the Drive
- Grant permissions
- Verify connection
Troubleshooting SharePoint #
Error: Redirect URI Mismatch"
- Cause: Google App redirect URI not configured
- Solution: Verify developer has added exact URI
Non-OAuth Integrations #
Some integrations don’t require OAuth configuration:
API Key Based Integrations #
Stripe:
- Navigate to Settings → Integrations → Stripe
- Enter test API key (starts with
sk_test_) - Click “Save”
- Verify connection
SendGrid:
- Navigate to Settings → Integrations → SendGrid
- Enter API key
- Click “Save”
- Send test email
Webhook Based Integrations #
Intercom:
- Get webhook URL from Settings → Integrations → Intercom
- Add webhook in Intercom admin panel
- Set webhook URL to:
https://app--preview--coder-preview-123--john.coder.internal.gotofu.com/webhook/intercom - Test webhook delivery
Integration Testing Checklist #
After configuring an integration, verify:
Initial Connection #
- OAuth flow completes without errors
- Connection status shows “Connected”
- Organization/Company name displays correctly
- Last sync time is recent
Data Sync #
- Manual sync triggers successfully
- Data appears in BonsAI after sync
- Sync logs show no errors
- Background sync works (if applicable)
Error Handling #
- Test with invalid data
- Verify error messages are clear
- Check that errors are logged properly
- Ensure retry logic works
Performance #
- Large dataset sync completes
- No timeout errors
- UI remains responsive during sync
- Background jobs process correctly
Best Practices #
For Developers #
- Test Early: Configure integrations at start of PR testing
- Use Test Accounts: Never use production accounts
- Document Changes: Note any integration-specific changes in PR
- Clean Up: Remove OAuth redirects after testing (optional)
For QA Engineers #
- Prepare Test Data: Set up test data in integration platforms
- Test Edge Cases: Try various scenarios (empty data, large datasets)
- Verify Error Handling: Test with disconnected integrations
- Document Issues: Include integration name and error details
For Product Managers #
- Request Early: Ask developers to configure integrations before demo
- Test User Flows: Verify end-to-end user experience
- Provide Feedback: Comment on UX and error messages
- Plan Ahead: Schedule integration testing for realistic timelines
Common Integration Issues #
OAuth Callback Issues #
Symptom: “Invalid Redirect URI” or “Callback URL not whitelisted”
Causes:
- Redirect URI not configured in provider portal
- Typo in redirect URI
- Protocol mismatch (http vs https)
Solution:
- Verify exact preview URL
- Ensure developer configured correct callback
- Check for trailing slashes
Token Expiration #
Symptom: “Token expired” or “Unauthorized” errors
Causes:
- OAuth token has expired
- Integration was disconnected
- Token refresh failed
Solution:
- Disconnect integration
- Reconnect through OAuth flow
- Verify new token works
Permission Issues #
Symptom: “Access Denied” or “Insufficient Permissions”
Causes:
- User account lacks required permissions
- OAuth scopes insufficient
- Organization-level restrictions
Solution:
- Use admin account for testing
- Verify required OAuth scopes
- Check organization settings
Data Sync Issues #
Symptom: Data not appearing after sync
Causes:
- Sync still in progress
- Filters excluding data
- Background job not running
- Integration error
Solution:
- Check sync logs for errors
- Verify background workers are running
- Check RabbitMQ queue status
- Review sync filters/settings
Getting Help #
Who to Contact #
For OAuth Configuration:
- Contact developers with admin access to integration portals
- Include: Preview URL, Integration type, PR number
For Integration Issues:
- Post in #engineering channel with:
- Preview URL
- Integration name
- Error message
- Steps to reproduce
For Test Account Access:
- Contact IT or team lead for:
- Xero sandbox organization
- QBO sandbox company
- SharePoint test site
- Other test accounts
Useful Resources #
Next Steps #
- Troubleshooting Preview Environments - Common issues
- API Documentation - BonsAI API reference