"""Workable — public widget endpoint behind `apply.workable.com/`: `GET https://apply.workable.com/api/v1/widget/accounts/{token}` → {name, description, jobs:[{title, shortcode, code, employment_type, telecommuting, department, url, published_on, created_at, country, city, state, function, locations:[{country, countryCode, city, region}]}]}. Verified 2026-09-12 against `epignosis` (fixture trimmed, descriptions removed).""" from __future__ import annotations import re from collections.abc import Mapping from typing import Any from companyatlas.connectors._ats_base import AtsConnector from companyatlas.connectors._util import country_code, parse_date, text_of from companyatlas.sdk.connector import ConnectorMeta, register from companyatlas.sdk.models import ExtractedJob from companyatlas.taxonomy import FetchMode, Surface @register class WorkableConnector(AtsConnector): vendor = "workable" token_re = re.compile(r"apply\.workable\.com/api/v1/widget/accounts/([a-z0-9_-]+)", re.IGNORECASE) meta = ConnectorMeta(connector_id="workable-v1", name="Workable widget", version="1", category=Surface.JOBS_BOARD, fetch_mode=FetchMode.JSON, default_interval_s=6 * 3600, url_pattern=r"apply\.workable\.com/api/v1/widget/accounts/", pattern_required=True, priority=50, accept="application/json", description="Public Workable widget API") def parse_jobs(self, data: Any, sensor: Mapping[str, Any]) -> list[ExtractedJob]: out: list[ExtractedJob] = [] for j in (data.get("jobs") if isinstance(data, dict) else []) or []: if not isinstance(j, dict) or not j.get("title"): continue locs = j.get("locations") or [] first = locs[0] if locs and isinstance(locs[0], dict) else {} city, state, country = j.get("city") or first.get("city"), j.get("state") or first.get("region"), j.get("country") or first.get("country") out.append(ExtractedJob( title=str(j["title"]), url=j.get("url") or j.get("shortlink"), external_id=str(j.get("shortcode") or j.get("code") or ""), department=text_of(j.get("department")), location_text=", ".join(x for x in (city, state, country) if x) or None, city=text_of(city), region=text_of(state), country=country_code(first.get("countryCode")) or country_code(country), remote=bool(j.get("telecommuting")) if j.get("telecommuting") is not None else None, employment_type=text_of(j.get("employment_type")), posted_at=parse_date(j.get("published_on") or j.get("created_at")), raw={"function": j.get("function"), "experience": j.get("experience"), "industry": j.get("industry")}, )) return out