Skip to content

[Sync] identityKeys (plural) — multiple cross-platform identity keys per record #128

@moekatib

Description

@moekatib

Problem

Today identityKey (singular) extracts one dot-path from a record and writes it as a prefixed key on the mem row (e.g. email:jane@acme.com). That works for 1:1 records like attio/attioPeople — but it doesn't fit records with N participants.

Concrete failure mode: a Gmail thread has many participants (from + to + cc across all messages). There's no single email to pick. A single identityKey is either wrong (picks one arbitrarily) or unset (no cross-platform linking at all — current state).

The same constraint applies to:

  • google-calendar/events → each attendee
  • Slack messages/threads → each participant
  • Fathom meetings → each calendar invitee
  • Linear issues → assignee + subscribers

Proposed

Add identityKeys: Array<{ prefix: string, path: string }> alongside identityKey. Each entry resolves via the existing dot-path walker; [] wildcard expands to one key per array element.

{
  "platform": "gmail",
  "model": "threads",
  "identityKeys": [
    { "prefix": "email", "path": "messages[].payload.headers[?(@.name=='From')].value" },
    { "prefix": "email", "path": "messages[].payload.headers[?(@.name=='To')].value" },
    { "prefix": "email", "path": "messages[].payload.headers[?(@.name=='Cc')].value" }
  ]
}

Same lowercase/trim/dedupe behavior as the current identityKey. Each resolved value becomes one entry in the record's keys array.

Acceptance

  • identityKeys array accepted in sync profiles alongside (or instead of) identityKey.
  • Wildcard paths expand to multiple keys; duplicates deduped.
  • Existing identityKey singular keeps working (backwards compatible).
  • sync test shows resolved identity keys in its output (how many keys per record, sample values).
  • Docs updated in one guide sync under "Cross-Platform Identity".

Related

Enables #129 (gmail), #130 (gcal/fathom), #131 (mem linked query). Found during PR #125 testing — see thread comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions