: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 datetime import date
from typing import Optional, cast
from products.warehouse_sources.sources.monday._config import MondaySourceConfig
from products.warehouse_sources.sources.monday.monday import (
MONDAY_VERSION_2026_07,
MONDAY_VERSION_2026_10,
MONDAY_VERSION_V2,
monday_source,
validate_credentials as validate_monday_credentials,
)
from products.warehouse_sources.sources.monday.settings import ENDPOINTS, MONDAY_ENDPOINTS
from products.warehouse_sources.sources.sdk import (
CanonicalDescriptions,
DataWarehouseSourceCategory,
ExternalDataSourceType,
FieldType,
ReleaseStatus,
SimpleSource,
SourceConfig,
SourceFieldInputConfig,
SourceFieldInputConfigType,
SourceInputs,
SourceRegistry,
SourceResponse,
SourceSchema,
VersionDeprecation,
detect,
)
@SourceRegistry.register
class MondaySource(SimpleSource[MondaySourceConfig]):
codebase_detection = detect(
env=("^MONDAY_TOKEN$", "^MONDAY_SIGNING_SECRET$"),
npm=("@mondaydotcomorg/api", "monday-sdk-js", "@mondaycom/apps-sdk"),
)
supported_versions = (MONDAY_VERSION_V2, MONDAY_VERSION_2026_07, MONDAY_VERSION_2026_10)
default_version = MONDAY_VERSION_2026_10
api_docs_url = "https://developer.monday.com/api-reference"
# "v2" sends `API-Version: 2024-10`, which monday deprecated on this date. monday now answers it with
# its maintenance version instead of rejecting it, so a v2 pin no longer selects what it names.
deprecated_versions = (VersionDeprecation(version=MONDAY_VERSION_V2, sunset_at=date(2026, 2, 15)),)
lists_tables_without_credentials = True # static endpoint catalog — safe for public docs
@property
def source_type(self) -> ExternalDataSourceType:
return ExternalDataSourceType.MONDAY
def get_non_retryable_errors(self) -> dict[str, str | None]:
# Scope GraphQL matches to auth/permission failures only — a broad "monday.com GraphQL error"
# key would also catch transient server-side errors and permanently disable the sync.
return {
"401 Client Error: Unauthorized for url: https://api.monday.com": "monday.com authentication failed. Please check your API token.",
"403 Client Error: Forbidden for url: https://api.monday.com": "monday.com rejected the request. Please check that your API token has access to the requested data.",
"monday.com GraphQL error: Not authenticated": "monday.com authentication failed. Please check your API token.",
"monday.com GraphQL error: User unauthorized": "monday.com rejected the request. Please check that your API token has access to the requested data.",
}
def get_retryable_errors(self) -> set[str]:
# `get_rows` already retries `MondayRetryableError` in-process with exponential backoff
# (edge 404s, 429s, 5xx, and monday.com's own transient internal server errors — see
# `_execute` in monday.py). Once that budget is exhausted the error still carries the
# "(retryable)" tag those raises were given for this exact purpose, so Temporal's activity
# retry can pick it back up without paging anyone on a monday.com-side blip.
return {"(retryable)"}
@property
def get_source_config(self) -> SourceConfig:
return SourceConfig(
name=ExternalDataSourceType.MONDAY,
category=DataWarehouseSourceCategory.PRODUCTIVITY,
keywords=["monday.com"],
label="monday.com",
caption="""Enter your monday.com API token to pull your boards and items into the PostHog Data warehouse.
You can find your personal API token in monday.com under your avatar > Developers > My access tokens (admins can also use the account API token). Items are synced from every board the token can access.""",
iconPath="/static/services/monday.png",
docsUrl="https://posthog.com/docs/cdp/sources/monday",
releaseStatus=ReleaseStatus.GA,
fields=cast(
list[FieldType],
[
SourceFieldInputConfig(
name="api_token",
label="API token",
type=SourceFieldInputConfigType.PASSWORD,
required=True,
placeholder="",
secret=True,
),
],
),
)
def get_canonical_descriptions(self) -> CanonicalDescriptions:
from products.warehouse_sources.sources.monday.canonical_descriptions import CANONICAL_DESCRIPTIONS
return CANONICAL_DESCRIPTIONS
def get_schemas(
self,
config: MondaySourceConfig,
team_id: int,
with_counts: bool = False,
names: list[str] | None = None,
force_refresh: bool = False,
api_version: str | None = None,
) -> list[SourceSchema]:
# Only the board activity log has a server-side time filter; every other
# GraphQL list query is full refresh only.
schemas = [
SourceSchema(
name=endpoint,
supports_incremental=bool(MONDAY_ENDPOINTS[endpoint].incremental_fields),
supports_append=False,
incremental_fields=MONDAY_ENDPOINTS[endpoint].incremental_fields,
)
for endpoint in ENDPOINTS
]
if names is not None:
names_set = set(names)
schemas = [s for s in schemas if s.name in names_set]
return schemas
def validate_credentials(
self,
config: MondaySourceConfig,
team_id: int,
schema_name: Optional[str] = None,
api_version: str | None = None,
) -> tuple[bool, str | None]:
if validate_monday_credentials(config.api_token, self.resolve_api_version(api_version)):
return True, None
return False, "Invalid monday.com API token"
def source_for_pipeline(self, config: MondaySourceConfig, inputs: SourceInputs) -> SourceResponse:
return monday_source(
api_token=config.api_token,
endpoint=inputs.schema_name,
logger=inputs.logger,
api_version=self.resolve_api_version(inputs.api_version),
should_use_incremental_field=inputs.should_use_incremental_field,
db_incremental_field_last_value=inputs.db_incremental_field_last_value,
)