Integration and API Spec
The reference during the build: every tool connection, auth scope, field mapping, and error-handling rule.
Integration and API Spec
Quote Generation and Follow-up
[YourCompany.com] · Sales Department · Prepared by FullSpec · [Today's Date]
This document is the definitive technical reference for every integration point in the Quote Generation and Follow-up automation. It covers authentication requirements, exact OAuth scopes, webhook configuration, field mappings between tools, credential store layout, and failure handling for each integration. The FullSpec team uses this specification to build and configure all connections. No integration detail should be hardcoded into workflow logic; everything sensitive must live in the shared credential store as described in Section 04.
01Tool inventory
02Per-tool integration detail
Acts as the primary trigger source and the system of record for deal stage. The automation reads deal and contact fields on trigger, and writes stage updates and document metadata back at two points: when the quote is sent and when the deal closes as Won or Lost.
Serves as the master pricing lookup table for the Quote Builder Agent. The automation reads rows from a named sheet to match product codes or service identifiers to current unit prices, discount bands, and line-item descriptions. The sheet must be structured as a clean flat lookup table with no merged cells.
Handles quote document generation, hosts the e-sign flow, and emits webhook events when the document is viewed or signed. The Quote Builder Agent creates the draft document via API; the Approval and Send Agent transitions the document status; the Follow-up and Close Agent listens for signing events.
Delivers the approved quote to the prospect and sends the timed follow-up email sequence. The automation sends on behalf of the authenticated user account (typically a shared sales alias). Gmail is not used for inbound parsing in this workflow.
Receives the approval request message from the Approval and Send Agent and captures the manager's structured response (approve or reject). The workflow uses Block Kit interactive messages so the approval is a button click rather than a free-text reply.
Receives invoice creation instructions from the Follow-up and Close Agent when a PandaDoc signing event confirms quote acceptance. The automation creates a draft invoice in Xero using line items and values sourced directly from the PandaDoc document, eliminating manual re-entry.
03Field mappings between tools
The tables below define every field translation that occurs at each agent handoff point. Use exact field names as shown; PandaDoc variable keys are case-sensitive, HubSpot internal property names use snake_case, and Google Sheets column headers must match exactly.
Handoff 1: HubSpot to Quote Builder Agent (Agent 1 input)
Handoff 2: Google Sheets to PandaDoc (Agent 1 document build)
Handoff 3: PandaDoc to Approval and Send Agent (Agent 2 trigger and payload)
Handoff 4: Approval and Send Agent writes back to HubSpot and Gmail
Handoff 5: PandaDoc webhook to Follow-up and Close Agent and then Xero (Agent 3)
04Build stack and orchestration
Credential store contents (all values below must be populated before any workflow is activated):
// HubSpot
hs_private_app_token = '<HubSpot private app token>'
hs_client_secret = '<HubSpot app client secret for signature validation>'
hs_pipeline_id = '<internal pipeline ID from HubSpot>'
hs_stage_quote_requested = '<internal stage value>'
hs_stage_quote_sent = '<internal stage value>'
hs_stage_won = '<internal stage value>'
hs_stage_lost = '<internal stage value>'
// Google Sheets
gsheets_service_account_json = '<full JSON key string for service account>'
gsheets_pricing_sheet_id = '<spreadsheet ID from URL>'
gsheets_pricing_range = 'Pricing!A1:G200'
// PandaDoc
pandadoc_api_key = '<PandaDoc API Bearer token>'
pandadoc_client_id = '<OAuth client ID if OAuth flow used>'
pandadoc_client_secret = '<OAuth client secret if OAuth flow used>'
pandadoc_template_id = '<quote template ID from PandaDoc>'
pandadoc_folder_id = '<target folder ID (optional)>'
pandadoc_webhook_url = '<automation platform inbound HTTPS endpoint>'
pandadoc_webhook_secret = '<shared secret set in PandaDoc webhook config>'
// Gmail
gmail_client_id = '<Google Cloud OAuth client ID>'
gmail_client_secret = '<Google Cloud OAuth client secret>'
gmail_refresh_token = '<refresh token from OAuth authorisation>'
gmail_sender_address = '<sending alias e.g. sales@[YourCompany.com]>'
gmail_subject_quote = 'Your quote from [YourCompany.com]: {quote_title}'
gmail_subject_followup_d3 = 'Just checking in on your quote, {prospect_first_name}'
gmail_subject_followup_d7 = 'Your quote expires soon — any questions?'
// Slack
slack_bot_token = '<xoxb- prefixed bot token>'
slack_signing_secret = '<Slack app signing secret>'
slack_approval_channel_id = '<channel ID not channel name>'
slack_approver_user_id = '<Slack user ID of sales manager>'
slack_interactivity_url = '<automation platform HTTPS endpoint for interactions>'
// Xero
xero_client_id = '<Xero OAuth app client ID>'
xero_client_secret = '<Xero OAuth app client secret>'
xero_refresh_token = '<refresh token from Xero PKCE OAuth flow>'
xero_tenant_id = '<Xero organisation/tenant ID>'
xero_revenue_account_code = '<chart of accounts code for sales revenue>'
xero_invoice_due_days = '30'
// Global configuration
discount_approval_threshold_pct = '15'
followup_day3_offset_hours = '72'
followup_day7_offset_hours = '168'05Error handling and retry logic
Every integration point must have a defined failure behaviour. Unhandled exceptions must never fail silently. All retry attempts use exponential backoff starting at 30 seconds unless stated otherwise. After the final retry, the workflow must route to the manual fallback defined in each row.
More documents for this process
Every document generated for Quote Generation & Follow-up.