Services
Pipeline Overview
The five services form a two-path pipeline. Both paths start from the same anchor record — an Opportunity, Contact, Account, or any other Salesforce record. The scope resolved in step 1 is shared and feeds both paths independently.
Record ID
│
▼
BuildScopeForRecord ← Step 1 (both paths)
│
├──────────────────────────────────────┐
│ call path │ email path
▼ ▼
GatherPhoneNumbersInScope ← Step 2 GetEmailMessageIds ← Step 3
│
▼
GetCallSegments ← Step 3
│
▼
GetTranscripts ← Step 4
Each response carries a typed conversion method to the next step — scope.toGatherPhoneNumbersRequest(), phoneNumbers.toGetCallSegmentsRequest(), callResult.toGetTranscriptsRequest(), scope.toGetEmailMessageIdsRequest(). You do not construct request objects manually.
Call path — driven by phone numbers. The E164 numbers gathered in step 2 are used as the filter for call segment queries. Any call involving a number belonging to an in-scope record appears, regardless of which CRM record holds that number.
Email path — driven by record IDs. EmailMessage records are matched directly from the scope via ActivityRelation, without phone number resolution. This is why GetEmailMessageIds branches from step 1 rather than step 2.
Services
| Service | Path | Step | What it does |
|---|---|---|---|
| BuildScopeForRecord | Both | 1 | Resolves which CRM records are in scope for the anchor record, using the BuildCommunicationScopeForRecord strategy. The starting point for every pipeline invocation. |
| GatherPhoneNumbersInScope | Call | 2 | Gathers normalised E164 phone numbers from the in-scope records using the GatherPhoneNumbersFromRecords strategy. The output is the phone number filter for call segment queries. |
| GetCallSegments | Call | 3 | Queries call segments matching the gathered phone numbers. Supports paging, date filtering, and source and handler restrictions. Each page's response feeds directly into GetTranscripts. |
| GetTranscripts | Call | 4 | Fetches transcripts for segments with Available status. Permission-aware — redacts summary and transcript text based on the running user's permission sets. |
| GetEmailMessageIds | 3 | Queries EmailMessage record IDs associated with the in-scope records via ActivityRelation. Returns IDs only; the caller queries EmailMessage for the fields they need. |