:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
from typing import Optional, cast
from products.warehouse_sources.sources.hibob._config import HiBobSourceConfig
from products.warehouse_sources.sources.hibob.hibob import (
hibob_source,
validate_credentials as validate_hibob_credentials,
)
from products.warehouse_sources.sources.hibob.settings import ENDPOINTS, INCREMENTAL_FIELDS
from products.warehouse_sources.sources.sdk import (
CanonicalDescriptions,
DataWarehouseSourceCategory,
ExternalDataSourceType,
FieldType,
ReleaseStatus,
SimpleSource,
SourceConfig,
SourceFieldInputConfig,
SourceFieldInputConfigType,
SourceInputs,
SourceRegistry,
SourceResponse,
SourceSchema,
build_endpoint_schemas,
detect,
)
@SourceRegistry.register
class HiBobSource(SimpleSource[HiBobSourceConfig]):
codebase_detection = detect(env=("^(HI_BOB|HIBOB)_",))
supported_versions = ("v1",)
default_version = "v1"
api_docs_url = "https://apidocs.hibob.com"
lists_tables_without_credentials = True # static endpoint catalog — safe for public docs
@property
def source_type(self) -> ExternalDataSourceType:
return ExternalDataSourceType.HIBOB
def get_canonical_descriptions(self) -> CanonicalDescriptions:
from products.warehouse_sources.sources.hibob.canonical_descriptions import CANONICAL_DESCRIPTIONS
return CANONICAL_DESCRIPTIONS
def get_non_retryable_errors(self) -> dict[str, str | None]:
# Repeated 401/403s trip HiBob's WAF (5-minute IP block), so failing
# fast on auth errors matters more than usual here.
return {
"401 Client Error: Unauthorized for url: https://api.hibob.com": "HiBob authentication failed. Please check your Service User ID and token (legacy API tokens were discontinued — only Service Users work).",
"403 Client Error: Forbidden for url: https://api.hibob.com": "HiBob denied access. Please add your Service User to a permission group with access to this data category.",
}
@property
def get_source_config(self) -> SourceConfig:
return SourceConfig(
name=ExternalDataSourceType.HIBOB,
category=DataWarehouseSourceCategory.HR___RECRUITING,
keywords=["bob"],
label="HiBob",
caption="""Enter your HiBob Service User credentials to pull your Bob HR data into the PostHog Data warehouse.
Create a Service User in Bob under Settings > Integrations > Automation > Service Users, then add it to a permission group with read access to the data categories you want to sync (e.g. People). Calls return 403 until permissions are granted.""",
iconPath="/static/services/hibob.png",
docsUrl="https://posthog.com/docs/cdp/sources/hibob",
releaseStatus=ReleaseStatus.BETA,
fields=cast(
list[FieldType],
[
SourceFieldInputConfig(
name="service_user_id",
label="Service User ID",
type=SourceFieldInputConfigType.TEXT,
required=True,
placeholder="",
secret=False,
),
SourceFieldInputConfig(
name="service_user_token",
label="Service User token",
type=SourceFieldInputConfigType.PASSWORD,
required=True,
placeholder="",
secret=True,
),
],
),
)
def get_schemas(
self,
config: HiBobSourceConfig,
team_id: int,
with_counts: bool = False,
names: list[str] | None = None,
force_refresh: bool = False,
api_version: str | None = None,
) -> list[SourceSchema]:
# HiBob has no updated-at filters; every stream is full refresh.
return build_endpoint_schemas(ENDPOINTS, INCREMENTAL_FIELDS, names)
def validate_credentials(
self, config: HiBobSourceConfig, team_id: int, schema_name: Optional[str] = None, api_version: str | None = None
) -> tuple[bool, str | None]:
return validate_hibob_credentials(config.service_user_id, config.service_user_token)
def source_for_pipeline(self, config: HiBobSourceConfig, inputs: SourceInputs) -> SourceResponse:
return hibob_source(
service_user_id=config.service_user_id,
service_user_token=config.service_user_token,
endpoint=inputs.schema_name,
team_id=inputs.team_id,
job_id=inputs.job_id,
)