Skip to content

feat: add leads and lead_labels streams#2

Merged
nickchang91 merged 1 commit intomasterfrom
feat/add-leads-stream
Apr 6, 2026
Merged

feat: add leads and lead_labels streams#2
nickchang91 merged 1 commit intomasterfrom
feat/add-leads-stream

Conversation

@nickchang91
Copy link
Copy Markdown

@nickchang91 nickchang91 commented Apr 6, 2026

What

Adds two new streams to tap-pipedrive: leads and lead_labels.

Changes

  • LeadsStreamGET /v1/leads with offset-based pagination. Extends DynamicSchemaStream so leads inherit deal custom field definitions via dealFields (Pipedrive API design: leads share the same custom field structure as deals). Flattens the nested value object into lead_value_amount and lead_value_currency.
  • LeadLabelsStreamGET /v1/leadLabels (FULL_TABLE). Syncs label definitions (for ex: Hot, Warm, Cold, Facebook Lead, Nurture) so label_ids on leads can be decoded.
  • Bug fix: timestamp parsing in update_state() — The base PipedriveStream.update_state() hardcoded .000000Z microseconds when parsing bookmarks, causing a ValueError on any record with non-zero microseconds (for ex: .629000Z). Fixed to handle variable microseconds by trying %Y-%m-%dT%H:%M:%S.%fZ first, then falling back to %Y-%m-%dT%H:%M:%SZ.

Files Changed

  • tap_pipedrive/streams/leads.py (new)
  • tap_pipedrive/streams/lead_labels.py (new)
  • tap_pipedrive/schemas/leads.json (new)
  • tap_pipedrive/schemas/lead_labels.json (new)
  • tap_pipedrive/streams/__init__.py (register new streams)
  • tap_pipedrive/tap.py (register new streams)
  • tap_pipedrive/stream.py (fix timestamp parsing in update_state)

- Add LeadsStream using GET /v1/leads with offset-based pagination,
  extending DynamicSchemaStream to inherit deal custom field definitions
  via dealFields (leads share the same custom field structure as deals)
- Add LeadLabelsStream for GET /v1/leadLabels (FULL_TABLE, no pagination)
- Add JSON schemas for leads and lead_labels
- Register both streams in __init__.py and tap.py
- Fix timestamp parsing in update_state() to handle variable microseconds
  (was hardcoded to .000000Z, fails on any non-zero microseconds value)
@nickchang91 nickchang91 merged commit 7e5ceca into master Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant