Back to Client Onboarding & Engagement Letters

Integration and API Spec

The reference during the build: every tool connection, field mapping, error scenario, and change-control rule.

4 pagesPDF · Technical
FS-DOC-05Technical

Integration and API Spec

Client Onboarding & Engagement Letters

01Tool inventory

The table below lists every tool connected in this automation, its role in the process, the authentication method required, the minimum plan needed to unlock API access, and which agent uses it.

Tool
Role
Auth Method
Min Plan
Used By
FullSpec Automation
Orchestration, workflow execution, and monitoring
API key (bearer token)
Standard ($165/month)
All agents; central orchestrator
Google Docs
Engagement letter template population and document generation
OAuth 2.0 (Google Workspace)
Google Workspace Business Starter
Engagement Letter Agent
PandaDoc
Engagement letter delivery and e-signature collection
API key (bearer token)
PandaDoc Business ($25/month)
Engagement Letter Agent
Gmail
Outbound document request emails and reminder sequences
OAuth 2.0 (Google Workspace)
Google Workspace Business Starter
Document Collection Agent
Karbon
Practice management: client record creation and task assignment
OAuth 2.0 (Karbon API)
Karbon Team
Onboarding Setup Agent
Google Docs and Gmail share the same OAuth 2.0 credential under the Google Workspace application. A single consent grant can cover both if the correct scopes are requested together.

02Per-tool integration detail

FullSpec Automation

Central orchestration layer. Manages workflow state, conditional branching, retry logic, and monitoring across all agents. Receives webhook events and dispatches tasks to downstream tools.

Auth method
API key passed as Authorization: Bearer <token> header on all outbound requests
Credential store key
FULLSPEC_API_KEY
Base URL
https://api.fullspec.io/v1
Key endpoints
POST /workflows/{id}/trigger; GET /workflows/{id}/runs/{run_id}; POST /workflows/{id}/runs/{run_id}/steps/{step_id}/complete
Rate limits
300 requests/minute per workspace; burst ceiling 500 requests/minute for up to 10 seconds; 429 response on breach
Webhook inbound
HMAC-SHA256 signature on X-FullSpec-Signature header; shared secret stored as FULLSPEC_WEBHOOK_SECRET
Constraints
Workflow run timeout: 72 hours; maximum 50 steps per workflow run; payload size limit 10 MB per step
// Inbound trigger payload (CRM new-client-won event)
{
  "event": "client.won",
  "client_id": "string",
  "client_name": "string",
  "client_email": "string",
  "service_type": "string",
  "assigned_manager": "string"
}
// Outbound step completion signal
{
  "run_id": "string",
  "step_id": "string",
  "status": "complete | failed",
  "output": { ... }
}
Google Docs

Used by the Engagement Letter Agent to copy a master template document and merge client-specific fields (name, service type, fee, date) before the resulting document URL is handed to PandaDoc.

Auth method
OAuth 2.0 via Google Identity Platform; authorization code flow with offline access (refresh token retained)
Credential store key
GOOGLE_OAUTH_CLIENT_ID, GOOGLE_OAUTH_CLIENT_SECRET, GOOGLE_OAUTH_REFRESH_TOKEN
Scopes required
https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/documents
Base URL
https://docs.googleapis.com/v1 (Docs API); https://www.googleapis.com/drive/v3 (Drive API)
Key endpoints
POST /drive/v3/files/{templateId}/copy; POST /docs/v1/documents/{docId}/batchUpdate (mergeTextReplacement)
Rate limits
Read requests: 300/minute/user; write requests: 60/minute/user; per-project quota 500 requests/100 seconds
Constraints
Template document must be shared with the service account; placeholder tokens use {{double_brace}} format; exported PDF via Drive export endpoint before PandaDoc upload
// Copy template
POST /drive/v3/files/{TEMPLATE_DOC_ID}/copy
Body: { "name": "Engagement Letter - {client_name} - {date}" }

// Merge fields
POST /docs/v1/documents/{new_doc_id}/batchUpdate
Body: { "requests": [
  { "replaceAllText": { "containsText": { "text": "{{client_name}}" }, "replaceText": "{client_name}" } },
  { "replaceAllText": { "containsText": { "text": "{{service_type}}" }, "replaceText": "{service_type}" } }
] }

// Export as PDF
GET /drive/v3/files/{new_doc_id}/export?mimeType=application/pdf
PandaDoc

Receives the generated engagement letter PDF, creates a PandaDoc document from it, assigns the client as recipient, and sends for e-signature. A webhook notifies FullSpec Automation when the document is signed.

Auth method
API key as Authorization: API-Key <key> header
Credential store key
PANDADOC_API_KEY
Base URL
https://api.pandadoc.com/public/v1
Key endpoints
POST /documents (multipart upload); POST /documents/{id}/send; GET /documents/{id}; Webhook: document_state_changed
Webhook events
document.completed (all parties signed); document.viewed; document.declined; verified via X-PandaDoc-Signature HMAC-SHA256
Rate limits
Business plan: 100 API requests/minute; document creation: 20 documents/minute; 429 with Retry-After header on breach
Constraints
PDF must be under 20 MB; recipient email must match a valid address; document expires after 30 days if unsigned (configurable in PandaDoc workspace settings)
// Create document from PDF upload
POST /public/v1/documents
Content-Type: multipart/form-data
Fields: file (PDF binary), data (JSON):
{
  "name": "Engagement Letter - {client_name}",
  "recipients": [{ "email": "{client_email}", "first_name": "{first_name}", "last_name": "{last_name}", "role": "client" }],
  "fields": { "signature_1": { "role": "client" } }
}

// Send for signature
POST /public/v1/documents/{document_id}/send
Body: { "message": "Please sign your engagement letter.", "subject": "Your engagement letter is ready" }

// Inbound webhook on completion
{ "event": "document_state_changed", "data": { "id": "string", "status": "document.completed" } }
Integration and API SpecPage 1 of 4
FS-DOC-05Technical
Gmail

Used by the Document Collection Agent to send the initial document and ID request email to the client, followed by automated reminder emails on a configured schedule until all items are received or escalated.

Auth method
OAuth 2.0 via Google Identity Platform; same application registration as Google Docs (shared refresh token)
Credential store key
GOOGLE_OAUTH_CLIENT_ID, GOOGLE_OAUTH_CLIENT_SECRET, GOOGLE_OAUTH_REFRESH_TOKEN (shared with Google Docs credential)
Scopes required
https://www.googleapis.com/auth/gmail.send, https://www.googleapis.com/auth/gmail.readonly (to detect reply/attachment)
Base URL
https://gmail.googleapis.com/gmail/v1
Key endpoints
POST /users/me/messages/send (RFC 2822 base64url body); GET /users/me/messages?q=threadId:{id} (poll for reply); GET /users/me/messages/{id}/attachments/{attachmentId}
Rate limits
Sending quota: 2,000 messages/day per Workspace account; 250 quota units/second per user; attachments: 25 MB per message
Constraints
Replies must be parsed by subject line thread matching; attachment MIME type check enforced before passing to ID/AML step; no direct AML integration in Gmail (AML handled externally and flagged via FullSpec Automation)
// Send document request email
POST /gmail/v1/users/me/messages/send
Body: { "raw": "<base64url RFC2822 message>" }
// Message headers: To: {client_email}, Subject: Action required: documents for your onboarding
// Body includes checklist: proof of identity, proof of address, signed letter confirmation

// Poll for client reply with attachments
GET /gmail/v1/users/me/messages?q=subject:Action+required+from:{client_email}&labelIds=INBOX
// If attachment found, retrieve and pass attachment_id to FullSpec Automation
Karbon

Used by the Onboarding Setup Agent to create the client contact record, assign the onboarding work item, and set the initial task checklist once all documents and compliance checks are clear.

Auth method
OAuth 2.0 (authorization code flow); Karbon partner application; access token + refresh token stored per workspace
Credential store key
KARBON_CLIENT_ID, KARBON_CLIENT_SECRET, KARBON_ACCESS_TOKEN, KARBON_REFRESH_TOKEN
Scopes required
contacts:read, contacts:write, work:read, work:write, notes:write
Base URL
https://app.karbonhq.com/api/v3
Key endpoints
POST /contacts (create client); POST /work (create work item); POST /work/{id}/tasks (add checklist tasks); GET /contacts?email={email} (deduplication check)
Rate limits
500 requests/minute per access token; 429 response with Retry-After; token expiry: 1 hour (refresh with refresh token before expiry)
Constraints
Client email must be unique in Karbon; deduplication GET call required before POST /contacts; work item requires a valid assignee user ID (resolve from GET /users before creating work item); all timestamps in ISO 8601 UTC
// Deduplication check
GET /api/v3/contacts?email={client_email}
// If 200 and results array non-empty: skip creation, use existing contact_id

// Create client contact
POST /api/v3/contacts
Body: {
  "type": "Organization",
  "name": "{client_name}",
  "email": "{client_email}",
  "assignedTo": "{manager_user_id}",
  "customFields": { "service_type": "{service_type}" }
}

// Create onboarding work item
POST /api/v3/work
Body: {
  "title": "Onboarding: {client_name}",
  "contactId": "{contact_id}",
  "assignedTo": "{manager_user_id}",
  "dueDate": "{due_date_iso8601}"
}

03Field mappings between tools

The tables below document every field that passes between tools at each agent handoff. Source and destination field names are shown in monospace. Transformation notes indicate any formatting or derivation applied in transit.

Handoff 1: CRM trigger to Engagement Letter Agent (Google Docs + PandaDoc)

Source Tool
Source Field
Destination Tool
Destination Field
Transformation
CRM / FullSpec trigger
client_id
Google Docs
{{client_id}}
Pass-through; used for file naming
CRM / FullSpec trigger
client_name
Google Docs
{{client_name}}
Pass-through; inserted into letter body
CRM / FullSpec trigger
client_email
PandaDoc
recipients[0].email
Pass-through; used for recipient record
CRM / FullSpec trigger
service_type
Google Docs
{{service_type}}
Pass-through; determines fee schedule paragraph
CRM / FullSpec trigger
assigned_manager
Google Docs
{{manager_name}}
Display name lookup from user directory
CRM / FullSpec trigger
event.timestamp
Google Docs
{{letter_date}}
ISO 8601 to DD Month YYYY format
Google Docs (export)
exported_pdf_binary
PandaDoc
file (multipart)
PDF byte stream passed as multipart/form-data
Google Docs
new_doc_id
FullSpec Automation
run.context.doc_id
Stored in run context for audit trail

Handoff 2: PandaDoc completion to Document Collection Agent (Gmail)

Source Tool
Source Field
Destination Tool
Destination Field
Transformation
PandaDoc webhook
data.id
FullSpec Automation
run.context.pandadoc_doc_id
Stored for downstream audit link
PandaDoc webhook
data.status
FullSpec Automation
run.step.signature_status
Checked against value 'document.completed'
FullSpec Automation context
run.context.client_email
Gmail
To header
Pass-through; RFC 2822 To field
FullSpec Automation context
run.context.client_name
Gmail
email_body.greeting
Interpolated into email template greeting
FullSpec Automation context
run.context.doc_checklist
Gmail
email_body.document_list
Array rendered as HTML ordered list
FullSpec Automation
run.context.reminder_schedule
Gmail
scheduled_send_at
D+3, D+7, D+14 intervals from send date

Handoff 3: Document Collection Agent to Onboarding Setup Agent (Karbon)

Source Tool
Source Field
Destination Tool
Destination Field
Transformation
FullSpec Automation context
run.context.client_name
Karbon
contacts.name
Pass-through
FullSpec Automation context
run.context.client_email
Karbon
contacts.email
Lowercase normalisation before POST
FullSpec Automation context
run.context.service_type
Karbon
contacts.customFields.service_type
Pass-through
FullSpec Automation context
run.context.assigned_manager
Karbon
work.assignedTo
Resolved to Karbon user ID via GET /users?email=
FullSpec Automation context
run.context.aml_cleared_at
Karbon
work.notes[0].body
Formatted as 'AML cleared: {ISO timestamp}'
FullSpec Automation context
run.context.pandadoc_doc_id
Karbon
work.notes[1].body
Formatted as 'Signed engagement letter: {pandadoc_id}'
Karbon response
contacts.id
FullSpec Automation
run.context.karbon_contact_id
Stored for work item creation and audit
Karbon response
work.id
FullSpec Automation
run.context.karbon_work_id
Stored for final ready-confirmation notification
Integration and API SpecPage 2 of 4
FS-DOC-05Technical

04Build stack and orchestration

The table below defines every component in the build stack, its version or edition, and its orchestration role. FullSpec Automation (n8n-compatible runtime) is the backbone; all other tools are nodes within its workflow graph.

Component
Version / Edition
Role
Hosted By
FullSpec Automation
Standard plan (n8n-compatible)
Workflow orchestrator: triggers, branching, retries, monitoring
[YourCompany.com] workspace (cloud)
n8n workflow engine
n8n v1.x (embedded in FullSpec)
Executes node graph; manages run state and error paths
FullSpec-managed cloud instance
Google Workspace
Business Starter or above
Google Docs template merge; Gmail send/poll
Google Cloud (SaaS)
PandaDoc
Business plan
Document send and e-signature collection
PandaDoc cloud (SaaS)
Karbon
Team plan
Practice management: client and work record creation
Karbon cloud (SaaS)
Credential store
FullSpec built-in secrets vault
Encrypted storage of all API keys and OAuth tokens
FullSpec-managed; AES-256 at rest
Webhook receiver
FullSpec inbound endpoint
Receives CRM trigger and PandaDoc completion events
FullSpec cloud (TLS 1.3)

n8n credential store: the following credential entries must be configured in the FullSpec Automation credential vault before any workflow node is activated. Each entry name below maps directly to the credential reference used in the node configuration.

n8n credential store entries (FullSpec Automation credential vault)
// ---- Google Workspace (shared OAuth 2.0 application) ----
Credential name : google_workspace_oauth
  GOOGLE_OAUTH_CLIENT_ID       : <Google Cloud Console OAuth client ID>
  GOOGLE_OAUTH_CLIENT_SECRET   : <Google Cloud Console OAuth client secret>
  GOOGLE_OAUTH_REFRESH_TOKEN   : <refresh token obtained via consent flow>
  Scopes                       : https://www.googleapis.com/auth/drive
                                 https://www.googleapis.com/auth/documents
                                 https://www.googleapis.com/auth/gmail.send
                                 https://www.googleapis.com/auth/gmail.readonly

// ---- PandaDoc ----
Credential name : pandadoc_api
  PANDADOC_API_KEY             : <PandaDoc workspace API key>
  PANDADOC_WEBHOOK_SECRET      : <shared secret for HMAC-SHA256 webhook validation>

// ---- Karbon ----
Credential name : karbon_oauth
  KARBON_CLIENT_ID             : <Karbon partner app client ID>
  KARBON_CLIENT_SECRET         : <Karbon partner app client secret>
  KARBON_ACCESS_TOKEN          : <current access token; auto-refreshed by node>
  KARBON_REFRESH_TOKEN         : <refresh token; stored encrypted>

// ---- FullSpec Automation ----
Credential name : fullspec_internal
  FULLSPEC_API_KEY             : <FullSpec workspace API key>
  FULLSPEC_WEBHOOK_SECRET      : <HMAC-SHA256 secret for inbound webhook validation>

// ---- Google Docs template reference (workflow variable, not secret) ----
  ENGAGEMENT_LETTER_TEMPLATE_DOC_ID : <Drive file ID of master template document>

05Error handling and retry logic

All errors are caught at the workflow node level by FullSpec Automation. The table below defines the error condition, the tool and node where it originates, the retry strategy, and the escalation action when retries are exhausted.

Error Condition
Tool / Node
HTTP / Signal
Retry Strategy
Escalation Action
CRM webhook signature invalid
FullSpec inbound receiver
401 / HMAC mismatch
No retry; discard event
Log to error channel; alert practice manager
Google OAuth token expired
Google Docs / Gmail node
401 Unauthorized
Auto-refresh once using refresh token; retry original request
If refresh fails: pause workflow, notify developer
Google Docs template copy failed
Google Docs node (copy)
500 / Drive quota exceeded
Exponential backoff: 30 s, 2 min, 5 min (3 attempts)
Halt workflow; alert practice manager with client name
Google Docs merge field not found
Google Docs node (batchUpdate)
200 but replaceCount = 0
No retry; flag as data warning
Log mismatched token; continue workflow with warning note
PandaDoc document creation failed
PandaDoc node (POST /documents)
422 / 500
Retry 3 times at 1 min intervals
Halt engagement letter flow; alert practice manager
PandaDoc send failed (recipient invalid)
PandaDoc node (POST /send)
422 Unprocessable
No retry; email format check required
Pause workflow; prompt manager to verify client email
PandaDoc document unsigned after 30 days
FullSpec scheduled check
Timeout condition
Send final reminder on day 25, day 28
Escalate to practice manager; create Karbon task
Gmail send quota exceeded
Gmail node (send)
429 / quota error
Delay 60 min; retry once per hour up to 3 attempts
If still failing: notify manager; send manually
Gmail reply poll returns no attachments after D+14
Gmail node (poll)
200 but no attachment found
Final reminder sent; poll again at D+17
Escalate to onboarding admin via FullSpec task
Karbon deduplication check fails
Karbon node (GET /contacts)
500 / timeout
Retry 3 times at 2 min intervals
Halt onboarding setup; alert developer and manager
Karbon contact creation conflict (duplicate)
Karbon node (POST /contacts)
409 Conflict
No retry; use existing contact_id from GET response
Log deduplication event; proceed with existing record
Karbon work item creation failed
Karbon node (POST /work)
500 / 422
Retry 3 times at 1 min intervals
If exhausted: create manual task in FullSpec for admin to set up Karbon work item manually
All retry exhaustion events write a structured error record to the FullSpec Automation run log with fields: run_id, step_id, error_code, error_message, client_id, and timestamp. These records are retained for 90 days.
Integration and API SpecPage 3 of 4
FS-DOC-05Technical

06Versioning and change control

All workflow definitions, field mapping documents, and credential references are version-controlled. The table below defines the versioning scheme, storage location, and change control process for each artefact type.

Artefact
Version Scheme
Storage Location
Change Process
Owner
FullSpec workflow definition (JSON export)
Semantic: MAJOR.MINOR.PATCH
Git repository: /workflows/client-onboarding/
Pull request required; minimum one reviewer; tagged release on merge
Developer
Google Docs engagement letter template
Date-stamped filename: engagement-letter-template-YYYYMMDD.docx
Google Drive: /Templates/Engagement Letters/
New copy created for each change; previous version moved to /Archive/; template Doc ID updated in credential store
Practice Manager
Field mapping specification (this document)
Semantic: MAJOR.MINOR.PATCH
Git repository: /docs/integration-api-spec.json
Updated on any tool-side schema change; version number incremented; changelog entry required
Developer
n8n credential store entries
No version number; change log maintained
FullSpec credential vault (encrypted)
Credential rotation logged with date, rotated-by, and reason; no credential value stored in Git
Developer
PandaDoc document template
PandaDoc internal version counter
PandaDoc workspace: Templates folder
New template version created in PandaDoc; old version archived; workflow node updated with new template ID
Practice Manager
API endpoint base URLs
Tracked in workflow node config
FullSpec workflow definition
URL change triggers MAJOR version increment on workflow; regression test suite must pass before promotion to production
Developer
Error handling and retry configuration
Tracked with workflow MINOR version
FullSpec workflow definition
Changes to retry counts or backoff require MINOR increment and regression test of affected error paths
Developer

Changelog entries follow the format below and are appended to /docs/CHANGELOG.md in the same pull request as the artefact change.

Changelog entry format
## [MAJOR.MINOR.PATCH] - YYYY-MM-DD
### Changed
- <artefact name>: <description of change>
### Reason
- <business or technical driver for the change>
### Tested by
- <name or role>
### Approved by
- <name or role>
Any change to a tool's OAuth scopes, API base URL, or webhook secret must be treated as a MAJOR version increment on the affected workflow. The full integration test suite (Test and QA Plan, FS-DOC-06) must be re-executed and results recorded before the updated workflow is promoted to the production environment.
Document reference
FS-DOC-05
Process
Client Onboarding & Engagement Letters
Prepared for
[YourCompany.com]
Date
[Today's Date]
Current version
1.0.0
Tools covered
FullSpec Automation, Google Docs, PandaDoc, Gmail, Karbon
Integration and API SpecPage 4 of 4

More documents for this process

Every document generated for Client Onboarding & Engagement Letters.

Launch Plan
Operations · Owner
View
ROI and Business Case
Finance · Owner
View
Process Runbook / SOP
Operations · Owner
View
Developer Handover Pack
Technical · Developer
View
Test and QA Plan
Quality · Developer
View