Back to Employee Onboarding

Integration and API Spec

The reference during the build: every tool connection, auth scope, field mapping, and error-handling rule.

4 pagesPDF · Technical
FS-DOC-05Technical

Integration and API Spec

Employee Onboarding Automation

[YourCompany.com] · HR Department · Prepared by FullSpec · [Today's Date]

This document is the authoritative technical reference for every integration point in the three-agent Employee Onboarding automation. It covers tool inventory, required OAuth scopes and credentials, webhook configuration, field mappings between agents, orchestration architecture, and the failure behaviour expected at every integration boundary. The FullSpec team uses this specification during build and testing. No integration should be connected to a production credential until the sandbox validation steps in Section 01 are complete.

01Tool inventory

Tool
Role in automation
Auth method
Min plan required
Used by agents
Automation platform (orchestration layer)
Hosts all three agent workflows, manages credential store, executes scheduling and retry logic
Internal service account
N/A (internal)
All agents
BambooHR
Primary trigger source; HR record store for new hire data and provisioning confirmation logs
API key (per-user or service account)
Essentials or higher (webhook support required)
Agent 1, Agent 2
DocuSign
Offer letter template population and e-signature dispatch; completion event source
OAuth 2.0 (Authorization Code Grant)
Standard or higher (template API access)
Agent 1
Gmail
Outbound email: information pack, document-chase reminders, and day-one welcome message
OAuth 2.0 (Authorization Code Grant) via Google Identity
Google Workspace Business Starter or higher
Agent 1, Agent 3
Google Workspace Admin SDK
Account creation, organisational unit assignment, Google Group membership
Service account with domain-wide delegation (JWT)
Google Workspace Business Starter or higher
Agent 2
Slack
Channel provisioning for new hire; structured manager briefing message
OAuth 2.0 (Bot Token, workspace-level install)
Pro or higher (invite by email requires Slack API app)
Agent 2, Agent 3
Notion
Onboarding page creation via template duplication and personalisation
OAuth 2.0 (internal integration token)
Plus or higher (API access and page sharing required)
Agent 3
Before you connect anything: every tool must be validated against a sandbox or test environment before production credentials are loaded into the credential store. For BambooHR, use a test employee record. For DocuSign, use the developer sandbox at account-d.docusign.com. For Google Workspace, use a test organisational unit isolated from live users. For Slack, use a dedicated test workspace. For Notion, duplicate the template into a test workspace. Production credentials must not be used during any phase of development or QA testing.
Integration and API SpecPage 1 of 4
FS-DOC-05Technical

02Per-tool integration detail

BambooHR

Acts as the master trigger source for the entire automation and as the final record store for provisioning confirmation logs. The orchestration layer subscribes to BambooHR's outgoing webhook on the employee status field.

Auth method
API key authentication. Generate a dedicated API key under Admin > API Keys. Store as BAMBOOHR_API_KEY in the credential store. The subdomain is stored separately as BAMBOOHR_SUBDOMAIN (e.g. yourcompany).
Required scopes
BambooHR API keys are scoped at the account level. The service key must have read access to: employees (all fields), custom fields, and webhook configuration. Write access is required for: employeeFiles (to log provisioning confirmation) and customFields (to write the onboarding_status flag).
Webhook setup
Navigate to Admin > Integrations > Webhooks. Create a POST webhook targeting the orchestration layer's inbound URL. Monitor field: Employment Status. Event filter: status equals 'Offer Accepted'. Payload format: JSON. Include fields: id, firstName, lastName, jobTitle, department, supervisorId, startDate, workEmail, hireDate, salary, employmentType. Enable webhook signature: set a shared secret stored as BAMBOOHR_WEBHOOK_SECRET. The orchestration layer must validate the X-BambooHR-Signature-V1 header on every inbound request before processing.
Required configuration
Department-to-Slack-channel mapping table must be stored in the credential store (see Section 04). Role-to-DocuSign-template mapping must be stored as DOCUSIGN_TEMPLATE_MAP (JSON object). supervisorId must resolve to a Slack user ID via the Slack user lookup; the lookup table SLACK_USER_MAP is stored in the credential store.
Rate limits
BambooHR API: 500 API calls per day per API key. At 3 hires/month, peak usage per run is approximately 8-12 API calls (record fetch, file upload, custom field write). Daily call volume will not approach the limit. No throttling required at current volume. Monitor if hire volume exceeds 15/month.
Constraints
Webhook fires on any status change; the orchestration layer must filter for 'Offer Accepted' only. If the BambooHR record lacks a startDate at trigger time, the Provisioning Agent must pause and re-poll at 6-hour intervals for up to 48 hours before raising an alert. BambooHR does not support webhook retries natively; the orchestration layer must implement idempotency using the employee id field.
// Webhook payload (inbound to orchestration layer)
{
  "employeeId": "string",
  "firstName": "string",
  "lastName": "string",
  "jobTitle": "string",
  "department": "string",
  "supervisorId": "string",
  "startDate": "YYYY-MM-DD",
  "workEmail": "string",
  "salary": "number",
  "employmentType": "string"
}

// Write-back on provisioning complete
PATCH /v1/employees/{employeeId}
{ "onboarding_status": "provisioned", "provisioning_date": "ISO8601" }
DocuSign

Used exclusively by Agent 1 (Document Agent) to populate role-specific offer letter templates and send them for e-signature. The completion webhook from DocuSign triggers the Gmail information pack step.

Auth method
OAuth 2.0 Authorization Code Grant. Redirect URI registered in the DocuSign developer portal. Tokens stored as DOCUSIGN_ACCESS_TOKEN and DOCUSIGN_REFRESH_TOKEN. Refresh token rotation must be implemented; refresh 60 seconds before expiry. Account ID stored as DOCUSIGN_ACCOUNT_ID. Base URI stored as DOCUSIGN_BASE_URI.
Required scopes
signature, impersonation, extended (for JWT grant if switching to service account flow). Minimum scopes for template population and envelope dispatch: signature. The impersonation scope is required if using JWT authentication on behalf of the HR admin user.
Webhook / Connect setup
Configure a DocuSign Connect listener (Admin > Connect > Add Configuration). Set the URL to the orchestration layer's DocuSign inbound endpoint. Events to monitor: envelope-completed, envelope-declined, envelope-voided. Enable HMAC signature validation using the secret stored as DOCUSIGN_CONNECT_SECRET. The orchestration layer must validate the X-DocuSign-Signature-1 header before acting on any event.
Required configuration
DOCUSIGN_TEMPLATE_MAP: a JSON object keyed by jobTitle (or employmentType) mapping to a DocuSign templateId. Example: { "Software Engineer": "tpl-abc123", "Account Manager": "tpl-def456" }. Each template must have named tab fields matching exactly: hire_first_name, hire_last_name, hire_job_title, hire_salary, hire_start_date, company_signatory_name. Template IDs are stored in the credential store, never hardcoded in workflow logic.
Rate limits
DocuSign Standard plan: 50 envelopes/month included. At 3 hires/month (approximately 3-6 envelopes including any re-sends), usage is well within limits. No throttling required. Envelope count must be monitored via the DocuSign usage dashboard; alert if approaching 40/month.
Constraints
If jobTitle does not match any key in DOCUSIGN_TEMPLATE_MAP, the Document Agent must halt envelope dispatch, set a BambooHR flag of 'template_missing', and send an alert to the HR Manager via Gmail. A new template must be created and the map updated manually before the agent retries. DocuSign sandbox and production environments use separate base URIs and account IDs; ensure the correct environment variable is active per deployment context.
// Create envelope from template
POST /v2.1/accounts/{accountId}/envelopes
{
  "templateId": "DOCUSIGN_TEMPLATE_MAP[jobTitle]",
  "templateRoles": [{
    "email": "hire.workEmail",
    "name": "hire.firstName + ' ' + hire.lastName",
    "roleName": "New Hire",
    "tabs": {
      "textTabs": [
        { "tabLabel": "hire_first_name", "value": "hire.firstName" },
        { "tabLabel": "hire_last_name",  "value": "hire.lastName"  },
        { "tabLabel": "hire_job_title",  "value": "hire.jobTitle"  },
        { "tabLabel": "hire_salary",     "value": "hire.salary"    },
        { "tabLabel": "hire_start_date", "value": "hire.startDate" }
      ]
    }
  }],
  "status": "sent"
}

// Connect event inbound (envelope completed)
{ "event": "envelope-completed", "envelopeId": "string", "completedDateTime": "ISO8601" }
Gmail (via Google Identity OAuth 2.0)

Used by Agent 1 (Document Agent) to send the information pack and document-chase reminders, and by Agent 3 (Onboarding Coordinator Agent) to send the day-one welcome email. All outbound mail is sent from the HR Manager's delegated mailbox.

Auth method
OAuth 2.0 Authorization Code Grant using the Google Identity platform. Tokens stored as GMAIL_ACCESS_TOKEN and GMAIL_REFRESH_TOKEN. The sending address (e.g. hr@[YourCompany.com]) is stored as GMAIL_SENDER_ADDRESS. Delegation must be enabled in Google Workspace Admin for the service account if using JWT-based send.
Required scopes
https://www.googleapis.com/auth/gmail.send (send-only; do not request broader gmail.modify or gmail.readonly unless inbox monitoring is added in a future build). If monitoring DocuSign reminder bounces, additionally: https://www.googleapis.com/auth/gmail.readonly scoped to a specific label.
Webhook / trigger setup
Gmail is used as an outbound action only in this build. No inbound webhook is configured. Outbound sends are triggered by: (a) DocuSign Connect envelope-completed event forwarded by Agent 1, (b) a scheduled re-poll timer for the document-chase loop (configurable window, default 72 hours), and (c) the Agent 3 start-date timer firing 3 days before hire.startDate.
Required configuration
Email body templates are stored as Jinja2-compatible HTML strings in the credential store under keys: GMAIL_TEMPLATE_INFO_PACK, GMAIL_TEMPLATE_CHASE_REMINDER, GMAIL_TEMPLATE_DAY_ONE_WELCOME. Template placeholders: {{hire_first_name}}, {{hire_last_name}}, {{hire_start_date}}, {{notion_page_url}}, {{hire_work_email}}, {{hiring_manager_name}}. Templates must not contain hardcoded names or URLs.
Rate limits
Gmail API: 250 quota units/second per user; sending limit 2,000 messages/day for Google Workspace accounts. At 3 hires/month with a maximum of 3 chase reminders per hire, peak send volume is under 30 messages/month. No throttling required.
Constraints
All emails must be sent as MIME multipart/alternative (plain text and HTML). If the Gmail API returns a 429 or 500, the orchestration layer must retry with exponential backoff (see Section 05). Emails must never be sent to the hire's personal email if workEmail is populated; workEmail takes precedence.
// Send via Gmail API
POST https://gmail.googleapis.com/gmail/v1/users/me/messages/send
Authorization: Bearer GMAIL_ACCESS_TOKEN
{
  "raw": "<base64url-encoded RFC 2822 message>"
}

// Message headers required
From: GMAIL_SENDER_ADDRESS
To: hire.workEmail
Subject: <template-specific subject string>
Content-Type: multipart/alternative
Google Workspace Admin SDK

Used exclusively by Agent 2 (Provisioning Agent) to create the new hire's Google account, assign the correct organisational unit, and add them to department Google Groups.

Auth method
Service account with domain-wide delegation. The service account JSON key is stored as GWS_SERVICE_ACCOUNT_KEY (base64-encoded JSON). The delegated admin email (an existing Workspace super-admin) is stored as GWS_ADMIN_EMAIL. Scopes are granted via the Google Workspace Admin console under Security > API Controls > Domain-wide Delegation.
Required scopes
https://www.googleapis.com/auth/admin.directory.user (create and manage users), https://www.googleapis.com/auth/admin.directory.group.member (add members to groups), https://www.googleapis.com/auth/admin.directory.orgunit (read OU structure to assign the correct unit). Do not grant admin.directory.user.security unless password reset is in scope.
Webhook / trigger setup
No webhook. Agent 2 is triggered by an internal event from the orchestration layer when the timer condition is met: 5 business days before hire.startDate, or immediately if startDate is fewer than 5 business days away. Business-day calculation must exclude weekends; a public holidays calendar is not required at current complexity but may be added as a future enhancement.
Required configuration
GWS_PRIMARY_DOMAIN: the Workspace domain (e.g. yourcompany.com). GWS_OU_MAP: a JSON object mapping department names to organisational unit paths, e.g. { "Engineering": "/Engineering", "Sales": "/Sales" }. GWS_GROUP_MAP: a JSON object mapping department names to Google Group email addresses. Default password policy: force reset on first login (changePasswordAtNextLogin: true). Temporary password generated by the orchestration layer using a cryptographically random 16-character string; stored transiently in memory only and passed to the hire via the day-one welcome email.
Rate limits
Admin SDK Directory API: 1,500,000 queries/day; per-user write operations: 10 writes/second. At 3 hires/month, peak usage is approximately 6 API calls per hire (create user, assign OU, add to 2 groups, read OU structure, verify creation). No throttling required.
Constraints
The account creation call is idempotent only if the email address is checked first via a GET users/{userKey} call before attempting POST. If the email already exists (e.g. a re-hire), the workflow must branch to an update path rather than create. The service account key must be rotated every 90 days; the credential store must surface the key creation date for monitoring.
// Create user
POST https://admin.googleapis.com/admin/directory/v1/users
{
  "primaryEmail": "hire.firstName.hire.lastName@GWS_PRIMARY_DOMAIN",
  "name": { "givenName": "hire.firstName", "familyName": "hire.lastName" },
  "password": "<generated-temp-password>",
  "changePasswordAtNextLogin": true,
  "orgUnitPath": "GWS_OU_MAP[hire.department]"
}

// Add to group
POST https://admin.googleapis.com/admin/directory/v1/groups/{groupKey}/members
{ "email": "hire.workEmail", "role": "MEMBER" }
Slack

Used by Agent 2 (Provisioning Agent) to invite the new hire to the Slack workspace and add them to the correct channels, and by Agent 3 (Onboarding Coordinator Agent) to send the structured hiring manager briefing.

Auth method
OAuth 2.0 Bot Token (xoxb-...). Install the automation's Slack app to the workspace via OAuth. Bot token stored as SLACK_BOT_TOKEN. The workspace ID is stored as SLACK_WORKSPACE_ID. The app must be installed by a Slack workspace admin.
Required scopes
users:write (invite user to workspace), channels:manage (add members to public channels), groups:write (add members to private channels), chat:write (post messages), users:read.email (look up existing user by email to resolve supervisorId to Slack user ID), im:write (open DM channel for direct messages if needed). Do not request admin scopes unless workspace-level user invitation via SCIM is used instead of the standard invite flow.
Webhook / trigger setup
No inbound webhook from Slack. Slack is used as an outbound action tool only. Agent 2 fires the invite after Google Workspace account creation is confirmed. Agent 3 fires the manager briefing message after Notion page creation is confirmed and the page URL is available.
Required configuration
SLACK_CHANNEL_MAP: a JSON object mapping department names to arrays of channel IDs, e.g. { "Engineering": ["C012AB3DE", "C045FG6HI"], "All": ["C000GENERAL"] }. Always include the company-wide general channel. SLACK_USER_MAP: a lookup table mapping BambooHR supervisorId values to Slack user IDs, maintained in the credential store. Manager briefing message template stored as SLACK_TEMPLATE_MANAGER_BRIEF with placeholders: {{hire_first_name}}, {{hire_job_title}}, {{hire_start_date}}, {{notion_page_url}}.
Rate limits
Slack Web API: Tier 3 methods (chat.postMessage, conversations.invite) allow approximately 50 requests/minute. At 3 hires/month with approximately 4-6 API calls per hire, daily volume is negligible. No throttling required. If invite-by-email calls return ratelimited, implement a 1-second delay between retries.
Constraints
users.lookupByEmail requires the hire's work email to already exist in Google Workspace; this call must occur after Agent 2 confirms account creation. If the supervisorId cannot be resolved to a Slack user ID via SLACK_USER_MAP, the manager briefing must fall back to posting in a configurable HR admin channel (SLACK_HR_FALLBACK_CHANNEL) with a flag for manual resolution. Slack invitations sent to email addresses not yet in the workspace consume a paid seat; confirm seat availability with the Slack admin before go-live.
// Invite user to workspace (by email)
POST https://slack.com/api/users.admin.invite
Authorization: Bearer SLACK_BOT_TOKEN
{ "email": "hire.workEmail", "channel_ids": ["C000GENERAL"] }

// Add to additional channels
POST https://slack.com/api/conversations.invite
{ "channel": "SLACK_CHANNEL_MAP[hire.department][n]", "users": "slack_user_id" }

// Post manager briefing
POST https://slack.com/api/chat.postMessage
{ "channel": "supervisor_slack_user_id", "text": "SLACK_TEMPLATE_MANAGER_BRIEF(rendered)" }
Notion

Used exclusively by Agent 3 (Onboarding Coordinator Agent) to duplicate the role-appropriate onboarding page template and personalise it with the new hire's details before sharing the URL with the hire and their manager.

Auth method
Notion internal integration token (ntn_...). Create an integration in the Notion developer portal and share the onboarding template database with the integration. Token stored as NOTION_TOKEN. The parent database ID for onboarding pages is stored as NOTION_ONBOARDING_DB_ID.
Required scopes
Notion integrations use capability-based permissions rather than OAuth scopes. The integration must have: Read content (to read the template page), Insert content (to create new pages), Update content (to personalise page properties after creation). The integration must be explicitly shared with the onboarding template page and the destination database in the Notion UI.
Webhook / trigger setup
No native Notion webhook is used. Agent 3 is triggered by an internal orchestration event once Agent 2 logs a successful provisioning confirmation to BambooHR. The newly created Notion page URL is captured from the API response and passed to the Slack manager briefing step and the day-one Gmail step.
Required configuration
NOTION_TEMPLATE_PAGE_ID: the page ID of the master onboarding template to duplicate. NOTION_ONBOARDING_DB_ID: the database that will contain all new hire onboarding pages. Page property fields that must be present in the template database schema: hire_name (title), hire_role (select or text), hire_start_date (date), hire_manager (text), notion_page_status (select: Draft / Active). Template content blocks must use the placeholder strings {{hire_first_name}}, {{hire_job_title}}, {{hire_start_date}}, and {{hiring_manager_name}} which are replaced via a post-creation content update call.
Rate limits
Notion API: 3 requests/second average; burst tolerance to approximately 10 requests/second. Agent 3 makes approximately 4-6 API calls per hire (read template, create page, update properties, update content blocks, retrieve page URL). No throttling required at current volume. Implement a 400ms delay between sequential block-content update calls to stay within burst limits.
Constraints
Notion does not provide a native page-duplication API endpoint. The duplication must be implemented by reading the template page's block children, creating a new page in NOTION_ONBOARDING_DB_ID, and writing the blocks individually. Rich text blocks with placeholder strings must be post-processed with the hire's data. Nested blocks (toggles, callouts) require recursive block reads. The page share setting must be set to 'Can view' for the hire and 'Can comment' for the manager using the page permissions endpoint once available; otherwise sharing is done by including both email addresses in the page properties or sending the URL directly.
// Create new page in database
POST https://api.notion.com/v1/pages
Notion-Version: 2022-06-28
Authorization: Bearer NOTION_TOKEN
{
  "parent": { "database_id": "NOTION_ONBOARDING_DB_ID" },
  "properties": {
    "hire_name":       { "title": [{ "text": { "content": "hire.firstName + hire.lastName" } }] },
    "hire_role":       { "rich_text": [{ "text": { "content": "hire.jobTitle" } }] },
    "hire_start_date": { "date": { "start": "hire.startDate" } },
    "hire_manager":    { "rich_text": [{ "text": { "content": "hire.supervisorName" } }] }
  }
}

// Response: capture page URL
{ "id": "<new-page-id>", "url": "https://www.notion.so/<new-page-id>" }
Integration and API SpecPage 2 of 4
FS-DOC-05Technical

03Field mappings between tools

The following tables define the exact field mappings for each agent handoff. Field names are shown in monospace exactly as they appear in the source and destination API payloads. Every field listed here must be validated as non-null before the downstream step executes; null handling is defined in Section 05.

Agent 1 handoff: BambooHR webhook to DocuSign envelope creation

Source tool
Source field
Destination tool
Destination field
BambooHR
`id`
DocuSign
`templateRoles[0].clientUserId`
BambooHR
`firstName`
DocuSign
`tabs.textTabs[hire_first_name].value`
BambooHR
`lastName`
DocuSign
`tabs.textTabs[hire_last_name].value`
BambooHR
`jobTitle`
DocuSign
`tabs.textTabs[hire_job_title].value`
BambooHR
`salary`
DocuSign
`tabs.textTabs[hire_salary].value`
BambooHR
`startDate`
DocuSign
`tabs.textTabs[hire_start_date].value`
BambooHR
`workEmail`
DocuSign
`templateRoles[0].email`
BambooHR
`jobTitle`
DocuSign
`templateId` (via `DOCUSIGN_TEMPLATE_MAP`)

Agent 1 handoff: DocuSign Connect event to Gmail information pack dispatch

Source tool
Source field
Destination tool
Destination field
DocuSign
`envelopeId`
Internal state
`run_context.docusign_envelope_id`
DocuSign
`completedDateTime`
Internal state
`run_context.offer_signed_at`
BambooHR (context)
`workEmail`
Gmail
`To` header
BambooHR (context)
`firstName`
Gmail
`GMAIL_TEMPLATE_INFO_PACK.{{hire_first_name}}`
BambooHR (context)
`startDate`
Gmail
`GMAIL_TEMPLATE_INFO_PACK.{{hire_start_date}}`

Agent 2 handoff: BambooHR record to Google Workspace account creation

Source tool
Source field
Destination tool
Destination field
BambooHR
`firstName`
Google Workspace Admin SDK
`name.givenName`
BambooHR
`lastName`
Google Workspace Admin SDK
`name.familyName`
BambooHR
`workEmail`
Google Workspace Admin SDK
`primaryEmail`
BambooHR
`department`
Google Workspace Admin SDK
`orgUnitPath` (via `GWS_OU_MAP`)
BambooHR
`department`
Google Workspace Admin SDK
`group email` (via `GWS_GROUP_MAP`)
Generated
`temp_password`
Google Workspace Admin SDK
`password`
Google Workspace Admin SDK
`primaryEmail`
BambooHR
`customField.work_email_confirmed`

Agent 2 handoff: Google Workspace confirmation to Slack provisioning

Source tool
Source field
Destination tool
Destination field
Google Workspace Admin SDK
`primaryEmail`
Slack
`email` (invite payload)
BambooHR (context)
`department`
Slack
`channel_ids` (via `SLACK_CHANNEL_MAP`)
BambooHR (context)
`supervisorId`
Slack
`channel` for manager DM (via `SLACK_USER_MAP`)

Agent 3 handoff: Provisioning confirmation to Notion page creation

Source tool
Source field
Destination tool
Destination field
BambooHR (context)
`firstName`
Notion
`properties.hire_name.title[0].text.content`
BambooHR (context)
`lastName`
Notion
`properties.hire_name.title[0].text.content` (appended)
BambooHR (context)
`jobTitle`
Notion
`properties.hire_role.rich_text[0].text.content`
BambooHR (context)
`startDate`
Notion
`properties.hire_start_date.date.start`
BambooHR (context)
`supervisorName`
Notion
`properties.hire_manager.rich_text[0].text.content`

Agent 3 handoff: Notion page URL to Slack manager briefing and Gmail day-one email

Source tool
Source field
Destination tool
Destination field
Notion
`url`
Slack
`SLACK_TEMPLATE_MANAGER_BRIEF.{{notion_page_url}}`
Notion
`url`
Gmail
`GMAIL_TEMPLATE_DAY_ONE_WELCOME.{{notion_page_url}}`
Google Workspace Admin SDK (context)
`primaryEmail`
Gmail
`GMAIL_TEMPLATE_DAY_ONE_WELCOME.{{hire_work_email}}`
BambooHR (context)
`firstName`
Gmail
`GMAIL_TEMPLATE_DAY_ONE_WELCOME.{{hire_first_name}}`
BambooHR (context)
`startDate`
Gmail
`GMAIL_TEMPLATE_DAY_ONE_WELCOME.{{hire_start_date}}`
Integration and API SpecPage 3 of 4
FS-DOC-05Technical

04Build stack and orchestration

Orchestration layout
Three discrete workflows: one per agent (Document Agent Workflow, Provisioning Agent Workflow, Onboarding Coordinator Agent Workflow). Each workflow is independently deployable and can be paused or restarted without affecting the others. A shared credential store is accessed by all three workflows; no credentials are stored inside individual workflow definitions. Inter-agent communication is handled via BambooHR custom field writes and an internal run-context object persisted in the orchestration layer's key-value store, keyed by BambooHR employeeId.
Document Agent trigger
Webhook (inbound). BambooHR fires a POST to the orchestration layer's inbound webhook endpoint when employee status changes to 'Offer Accepted'. The orchestration layer validates the X-BambooHR-Signature-V1 HMAC header using BAMBOOHR_WEBHOOK_SECRET before any processing begins. Duplicate webhook deliveries are deduplicated using the employeeId as an idempotency key stored with a 24-hour TTL.
Provisioning Agent trigger
Scheduled poll plus event. On receipt of a BambooHR webhook (same trigger as Document Agent), the orchestration layer calculates the number of business days until hire.startDate. If 5 or more business days remain, a scheduled job is created to fire the Provisioning Agent at (startDate minus 5 business days) at 08:00 local time. If fewer than 5 business days remain, the agent fires immediately after the Document Agent workflow has dispatched the offer letter. No direct dependency on DocuSign completion; provisioning does not wait for the offer to be signed.
Onboarding Coordinator Agent trigger
Event-based. Fires when the Provisioning Agent writes a provisioning_status of 'provisioned' to the BambooHR custom field. The orchestration layer polls BambooHR for this field update every 10 minutes with a maximum wait of 4 hours before raising a stalled-run alert. This ensures that the Notion page URL and day-one email are only sent once credentials exist.
Credential store type
Environment-variable-based encrypted secret store within the orchestration platform. All secrets are referenced by variable name in workflow logic; values are injected at runtime and never logged. Access is restricted to the automation service account only.
Run context persistence
Each hire run is identified by a run_id (BambooHR employeeId + ISO8601 date string, hashed). Run context object is written to the orchestration layer's internal key-value store at trigger time and read by all three agent workflows. It is deleted 30 days after hire.startDate.
Credential store: all variable names referenced in workflow logic; values managed in the orchestration platform's encrypted secret store
// Credential store contents (all values injected at runtime, never hardcoded)

// BambooHR
BAMBOOHR_API_KEY=<api-key>
BAMBOOHR_SUBDOMAIN=<subdomain>
BAMBOOHR_WEBHOOK_SECRET=<shared-secret-for-hmac>

// DocuSign
DOCUSIGN_CLIENT_ID=<oauth-client-id>
DOCUSIGN_CLIENT_SECRET=<oauth-client-secret>
DOCUSIGN_ACCOUNT_ID=<account-id>
DOCUSIGN_BASE_URI=<https://na4.docusign.net>
DOCUSIGN_ACCESS_TOKEN=<token>          // rotated automatically
DOCUSIGN_REFRESH_TOKEN=<token>         // rotated automatically
DOCUSIGN_CONNECT_SECRET=<hmac-secret>
DOCUSIGN_TEMPLATE_MAP={"Software Engineer":"tpl-abc123","Account Manager":"tpl-def456"}

// Gmail / Google Identity
GMAIL_CLIENT_ID=<oauth-client-id>
GMAIL_CLIENT_SECRET=<oauth-client-secret>
GMAIL_ACCESS_TOKEN=<token>             // rotated automatically
GMAIL_REFRESH_TOKEN=<token>            // rotated automatically
GMAIL_SENDER_ADDRESS=hr@[YourCompany.com]
GMAIL_TEMPLATE_INFO_PACK=<html-string-with-placeholders>
GMAIL_TEMPLATE_CHASE_REMINDER=<html-string-with-placeholders>
GMAIL_TEMPLATE_DAY_ONE_WELCOME=<html-string-with-placeholders>

// Google Workspace Admin SDK
GWS_SERVICE_ACCOUNT_KEY=<base64-encoded-service-account-json>
GWS_ADMIN_EMAIL=admin@[YourCompany.com]
GWS_PRIMARY_DOMAIN=[YourCompany.com]
GWS_OU_MAP={"Engineering":"/Engineering","Sales":"/Sales","HR":"/HR"}
GWS_GROUP_MAP={"Engineering":"eng-team@[YourCompany.com]","Sales":"sales-team@[YourCompany.com]"}
GWS_KEY_CREATED_DATE=<ISO8601>         // monitored for 90-day rotation

// Slack
SLACK_BOT_TOKEN=xoxb-<token>
SLACK_WORKSPACE_ID=<workspace-id>
SLACK_CHANNEL_MAP={"Engineering":["C012AB3DE","C000GENERAL"],"Sales":["C098XY1ZA","C000GENERAL"]}
SLACK_USER_MAP={"bhr-supervisor-001":"U012SLACK1","bhr-supervisor-002":"U034SLACK2"}
SLACK_HR_FALLBACK_CHANNEL=C00HRFALLBK
SLACK_TEMPLATE_MANAGER_BRIEF=<message-string-with-placeholders>

// Notion
NOTION_TOKEN=ntn-<internal-integration-token>
NOTION_ONBOARDING_DB_ID=<database-id>
NOTION_TEMPLATE_PAGE_ID=<template-page-id>

05Error handling and retry logic

Unhandled exceptions must never fail silently. Every integration boundary has a defined failure path. If a step exhausts its retry budget, the orchestration layer must write a failure flag to the BambooHR custom field onboarding_error, log the error with the run_id and step name, and send an alert to SLACK_HR_FALLBACK_CHANNEL. The HR Manager must then take manual action and clear the flag before the affected workflow step is retried.
Integration
Scenario
Required behaviour
BambooHR webhook
Webhook payload fails HMAC signature validation
Reject with HTTP 401. Log the attempt with the raw payload hash. Do not process. Alert SLACK_HR_FALLBACK_CHANNEL. No retry.
BambooHR webhook
Duplicate webhook delivery (same employeeId within 24-hour TTL)
Detect via idempotency key. Return HTTP 200 to BambooHR (prevent re-delivery loop). Discard payload. Log deduplication event.
BambooHR API (record fetch)
GET employee returns 404 (record deleted between webhook and fetch)
Retry once after 60 seconds. If still 404, halt workflow, write onboarding_error flag, alert SLACK_HR_FALLBACK_CHANNEL with employeeId.
BambooHR API (record fetch)
startDate field is null at trigger time
Re-poll BambooHR for the startDate field every 6 hours for up to 48 hours. If still null after 48 hours, halt and alert HR. Do not proceed to DocuSign dispatch.
DocuSign envelope creation
jobTitle not found in DOCUSIGN_TEMPLATE_MAP
Halt envelope dispatch. Write BambooHR flag template_missing. Send Gmail alert to GMAIL_SENDER_ADDRESS with hire details and missing jobTitle string. Await HR action. No automatic retry; retry is triggered manually after map is updated.
DocuSign envelope creation
API returns 5xx or network timeout
Retry up to 3 times with exponential backoff: 30s, 2 min, 8 min. If all retries fail, halt and alert SLACK_HR_FALLBACK_CHANNEL. HR must send offer letter manually.
DocuSign Connect event
envelope-declined or envelope-voided received
Write BambooHR flag offer_declined or offer_voided. Halt all downstream agents. Send alert to GMAIL_SENDER_ADDRESS and SLACK_HR_FALLBACK_CHANNEL. No automatic retry; HR must resolve and re-trigger manually.
Gmail send (info pack or chase reminder)
API returns 429 (rate limited)
Retry after 60-second delay. Retry up to 5 times. If all retries fail after 5 minutes total, log failure and alert SLACK_HR_FALLBACK_CHANNEL. HR must send email manually.
Gmail send (info pack or chase reminder)
API returns 5xx
Retry up to 3 times with exponential backoff: 30s, 2 min, 8 min. If all fail, log failure with run_id and template key. Alert SLACK_HR_FALLBACK_CHANNEL. Do not block downstream agents.
Google Workspace Admin SDK (user creation)
primaryEmail already exists (re-hire case)
Detect via GET users/{userKey} pre-check. Branch to update path: verify account is active, update orgUnitPath and group membership if changed. Log re-hire event. Do not attempt to create a duplicate account.
Google Workspace Admin SDK (user creation)
API returns 403 (insufficient delegation scope)
Halt Provisioning Agent immediately. Log scope error with the specific scope string that was rejected. Alert SLACK_HR_FALLBACK_CHANNEL and log to run context. Do not retry until GWS_SERVICE_ACCOUNT_KEY scopes are corrected by IT Admin.
Slack (user invite)
supervisorId cannot be resolved in SLACK_USER_MAP
Post manager briefing to SLACK_HR_FALLBACK_CHANNEL instead, with a note that the supervisor Slack ID is missing. Log the unresolved supervisorId. Do not block Notion page creation or day-one email.
Notion (page creation)
API returns 404 for NOTION_TEMPLATE_PAGE_ID
Halt Onboarding Coordinator Agent. Log the missing template page ID. Alert SLACK_HR_FALLBACK_CHANNEL. HR must verify the template page has not been deleted or moved and update NOTION_TEMPLATE_PAGE_ID in the credential store before manual retry.
Notion (block content update)
API returns 409 (conflict on concurrent update)
Retry after 2-second delay with up to 3 retries. Implement sequential (not parallel) block update calls with 400ms spacing to prevent burst conflicts. If conflict persists, log and alert SLACK_HR_FALLBACK_CHANNEL.
Gmail (day-one welcome email)
Sent more than 3 days before startDate by miscalculation
The orchestration layer must validate that the scheduled send datetime is within the window of (startDate minus 3 days) to (startDate minus 1 day) before queuing the send. If the calculated datetime falls outside this window, hold and alert SLACK_HR_FALLBACK_CHANNEL for manual review.
Integration and API SpecPage 4 of 4

More documents for this process

Every document generated for Employee Onboarding.

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