πCRM Integration: Universal Questions Inference Results
This guide describes how to extract evaluatio results for universal questions from the Trusst platform database and integrate them with backend systems such as Salesforce or Microsoft Dynamics.
CRM Integration: Universal Questions Inference Results (Direct Database Access)
Overview
This guide describes how to extract inference results for universal questions from the Trusst platform database using direct database access for GenesysOnPremise and PremierContactPoint (S3-based) streams and integrate them with Customer Relationship Management (CRM) systems such as Salesforce and Microsoft Dynamics.
Universal questions are evaluation questions that apply to all contacts regardless of which criteria is deduced during inference. These questions typically represent:
Core compliance requirements (e.g., "Did agent identify themselves?")
Standard quality metrics across all conversation types
Universal performance indicators
Since universal questions are evaluated on every contact, their inference results provide consistent, comparable metrics that can be synchronized to backend systems for reporting, analytics, and compliance tracking.
β οΈ Important Notices
Schema Stability Warning
This documentation reflects the database schema as of November 2025. Schema changes may occur in future Trusst platform updates. We recommend:
Using the provided SQL queries as templates only
Testing queries after platform upgrades before production use
Implementing robust error handling for schema changes
Contacting Trusst support before major platform upgrades
Monitoring the Trusst platform release notes for schema changes
Alternative: API Endpoint (Recommended)
For production deployments requiring long-term stability and security, consider using the REST API endpoint approach instead of direct database access. See the separate document: crm-integration-universal-questions-api.md for the recommended API-based integration approach.
Direct database access is suitable for:
Development and testing environments
Custom analytics requiring complex joins
One-time data migrations or backfills
Organizations with dedicated database administrators
Supported Stream Types
This document covers GenesysOnPremise and PremierContactPoint (S3-based) streams only. For other stream types (BrightPattern, Genesys Cloud, ContactSpace), please use the API endpoint approach.
Database Connection
Production Database Access
Recommended Approach: Use an Aurora PostgreSQL read replica to avoid impacting production performance.
Connection Details
Database Type: PostgreSQL (Aurora)
Network Access: Database is in a private VPC subnet. Requires VPN connection or VPC peering
Credentials: Read-only database credentials are stored in AWS Secrets Manager
Secret Path:
trusst/{customer_name}/db-readonly-userContains:
username,password,host,port,database
SSL/TLS: Required for all database connections
Retrieving Credentials from AWS Secrets Manager
Network Access Requirements
Contact Trusst Support to configure:
VPN connection to customer VPC, OR
VPC peering between customer AWS account and Trusst deployment VPC
Security group rules to allow inbound PostgreSQL traffic (port 5432) from integration server
Database Schema
Relevant Tables
questions Table
Stores question definitions including universal questions.
Key Columns:
question_id(String, PK): Unique question identifierkey(String): Question key (e.g., "agent_identified", "compliance_check")text(String): The question text shown to evaluatorsresult_type(String): Type of answer - Boolean, Rating, Paragraph, Label, Summaryis_universal(Boolean): True for universal questionsis_scored(Boolean): Whether this question contributes to scoringgroup(String): Question group (e.g., Compliance, Quality)created_at(Timestamp): When the question was created
inferences Table
Stores inference results linking questions to contacts.
Key Columns:
inference_id(String, PK): Unique inference identifiercontact_id(String, FK): Foreign key to contacts tablequestion_id(String, FK): Foreign key to questions tableresult(String): The inference result valuecreated_at(Timestamp): When the inference was generatedupdated_at(Timestamp): Last update timestamp
contacts Table
Stores conversation contact records.
Key Columns:
contact_id(String, PK): Unique contact identifierstream_id(String, FK): Foreign key to stream (data source)external_id(String): External system identifier (e.g., Genesys conversation ID)start_time(Timestamp): When the contact starteddirection(String): Call direction - "inbound" or "outbound"current_stage(String): Processing stage - e.g., "COMPLETED", "TRANSCRIPTION", "INFERENCE"agent_id(String): Agent who handled the contactcreated_at(Timestamp): Record creation timestamp
s3_conversations Table
Stores metadata for S3-sourced conversations (GenesysOnPremise, PremierContactPoint streams).
Key Columns:
conversation_id(String, PK): Unique conversation identifiercontact_id(String, FK): Foreign key to contacts tablestream_id(String, FK): Foreign key to streamconn_id(String): Connection ID from source system (e.g., Genesys recording ID)agent_id(String): Agent identifier from source systemcall_time(Timestamp): When the call occurredaudio_s3_key(String): S3 key for audio filemetadata_s3_key(String): S3 key for metadata file
Note: The s3_conversations table contains additional agent and connection metadata specific to S3-sourced conversations (GenesysOnPremise, PremierContactPoint). This table is essential for the queries in this document.
SQL Query: Fetch Universal Question Inference Results
Basic Query for Genesys On-Premise / PremierContactPoint
This query retrieves universal question inference results for GenesysOnPremise and PremierContactPoint (S3-based) stream types:
Field Notes:
call_time: Call time from s3_conversations table (when the call occurred in source system)contact_agent_id: Agent ID from contacts table (always populated)s3_agent_id: Agent ID from s3_conversations table (should always be populated for S3-based streams)conn_id: Connection/recording ID from GenesysOnPremise/PremierContactPoint source systemdirection: Call direction ("inbound" or "outbound")start_time: Contact start timestamp from contacts tableFilter: Only includes contacts where
current_stage = 'COMPLETED'(fully processed)
Sample Result
c1a2b3c4-...
550e8400-...
2025-01-15 14:23:10
2025-01-15 14:23:05
inbound
agent_john
john.smith
REC-001
agent_identified
true
c1a2b3c4-...
550e8400-...
2025-01-15 14:23:10
2025-01-15 14:23:05
inbound
agent_john
john.smith
REC-001
compliance_check
true
c1a2b3c4-...
550e8400-...
2025-01-15 14:23:10
2025-01-15 14:23:05
inbound
agent_john
john.smith
REC-001
quality_score
8
d5e6f7g8-...
6ba7b810-...
2025-01-15 13:45:22
2025-01-15 13:45:18
outbound
agent_sarah
sarah.jones
REC-002
agent_identified
false
d5e6f7g8-...
6ba7b810-...
2025-01-15 13:45:22
2025-01-15 13:45:18
outbound
agent_sarah
sarah.jones
REC-002
compliance_check
true
d5e6f7g8-...
6ba7b810-...
2025-01-15 13:45:22
2025-01-15 13:45:18
outbound
agent_sarah
sarah.jones
REC-002
quality_score
7
Note: Each contact has multiple rows (one per universal question). Only contacts with current_stage = 'COMPLETED' are included.
Time-Range Batching Query
For efficient processing, fetch results in time-based batches:
Parameters:
:start_time- Start of time range (e.g.,2025-01-01 00:00:00):end_time- End of time range (e.g.,2025-01-02 00:00:00)
Example Usage (Python with SQLAlchemy):
Incremental Sync Query (Delta)
For ongoing synchronization, fetch only new or updated inferences since last sync:
Parameters:
:last_sync_time- Timestamp of last successful CRM sync
Use Case: Scheduled sync jobs that run every 15 minutes to push only new results to CRM.
Pivoted Query: One Row Per Contact
For easier CRM mapping, pivot results so each contact has one row with columns for each universal question:
Note: Replace 'agent_identified', 'compliance_check', etc. with your actual universal question keys.
Integration Process
Step 1: Identify Universal Questions
Query the questions table to get all universal question keys:
Use this to understand which fields you'll need to map to your CRM.
Step 2: Batch Extraction Strategy
Recommended Approach: Time-based batching with incremental sync
Initial Sync: Fetch all historical data in daily or weekly batches
Ongoing Sync: Run incremental sync every 15 minutes using
updated_atfilter
Example Batch Strategy:
Step 3: CRM Field Mapping
Map Trusst inference results to CRM custom fields:
contact_id
Trusst_Contact_ID__c
trusst_contact_id
external_id
External ID field (match key)
Match key field
call_time
Call_Date__c
calldate
start_time
Call_Start_Time__c
call_start_time
direction
Call_Direction__c (Picklist)
call_direction (Option Set)
contact_agent_id
Agent_ID__c
agentid
S3-based stream fields (GenesysOnPremise/PremierContactPoint)
s3_agent_id
S3_Agent_ID__c
s3_agent_id
conn_id
Connection_ID__c
connection_id
Universal question results
Question results
Custom fields per question
Custom fields per question
Field Notes:
direction: Create as Picklist/Option Set with values: "inbound", "outbound"contact_agent_id: Always populated, represents the primary agent identifiers3_agent_idandconn_id: Should always be populated for GenesysOnPremise/PremierContactPoint streams
Example: If you have a universal question with key "agent_identified":
Salesforce: Create custom field
Agent_Identified__c(Checkbox)Dynamics: Create custom field
agent_identified(Two Options: Yes/No)
Step 4: Upsert to CRM
Use the CRM's bulk API to efficiently write data:
Salesforce Example (using simple-salesforce):
MuleSoft API Integration Example (for customers using MuleSoft as intermediary):
For organizations using MuleSoft as an integration layer between Trusst and Salesforce, you'll send data to a MuleSoft API endpoint instead of directly to Salesforce:
MuleSoft Payload Structure:
The MuleSoft API expects a structured JSON payload with grouped contact data:
MuleSoft Integration Benefits:
Centralized Integration Logic: Business rules and transformations managed in MuleSoft
Error Handling: MuleSoft handles retries, logging, and error notifications
Multiple Target Systems: Single API can update Salesforce, data warehouses, and other systems
Validation: MuleSoft can validate and enrich data before writing to Salesforce
Audit Trail: Comprehensive logging of all integration activities
Microsoft Dynamics Example (using REST API):
Best Practices
1. Use External IDs for Matching
Store the Trusst
contact_idas a custom field in your CRMUse CRM's native external ID or unique identifier for upsert operations
This ensures idempotent writes (re-running sync won't create duplicates)
2. Handle Result Type Conversion
Universal questions can have different result types:
Boolean
'true' / 'false'
Checkbox / Two Options
Parse string to boolean
Rating
'1' to '10'
Number
Parse string to integer
Paragraph
Long text
Text Area / Memo
Use as-is
Label
'Excellent', 'Good', etc.
Picklist / Option Set
Map to CRM picklist values
Example Conversion:
3. Error Handling and Retry Logic
Implement exponential backoff for CRM API rate limits
Log failed records for manual review
Use database transactions to track sync state
Example:
4. Track Sync State (Optional)
Create a sync status table to track synchronization:
5. Scheduled Sync Job
Run a scheduled job (cron, Airflow, etc.) for continuous synchronization:
Performance Considerations
Batch Size Recommendations
Salesforce
200 records/batch
15,000 (varies by edition)
Microsoft Dynamics
100-1000 records/batch
Unlimited (rate limited)
Query Optimization
Use Pagination: For large result sets, use LIMIT/OFFSET:
Complete Integration Example
Python Script: Sync Universal Questions to Salesforce
Run Example:
Summary
This guide provides the SQL queries and integration process for extracting universal question inference results from the Trusst platform and synchronizing them with CRM systems.
Key Takeaways:
Universal questions (identified by
is_universal = TRUE) are evaluated on all contactsUse time-based batching for efficient extraction
Implement incremental sync using
updated_atfor ongoing synchronizationMap Trusst result types to appropriate CRM field types
Use bulk APIs for efficient CRM writes
Track sync state and implement error handling for production reliability
For questions or support, please refer to the Trusst platform documentation or contact the engineering team.
Last updated