Understanding how to structure queries in N2CS to access customer data safely and efficiently. Learn about read-only access patterns and query optimization.
Understanding how to structure queries in N2CS to access customer data safely and efficiently. Learn about read-only access patterns and query optimization.
N2CS uses approved searches that are defined by admins in advance. CS agents can only select from admin-approved searches, ensuring all data access is intentional, controlled, and auditable.
Unlike free-form database queries, N2CS searches follow predefined patterns that optimize for both safety and performance. Every search in N2CS is read-only by design, meaning you can retrieve information without any risk of modifying customer data.
CS teams don't see database schemas or have write access. They only see the approved search interfaces, ensuring no schema exposure and no risk of accidental modifications.
Admins define and approve search types that CS teams can use. These searches are optimized for specific operational needs. Examples include:
These queries retrieve basic customer account information:
Query Type: Customer Info
Input: customer_id OR email OR phone
Returns: Account details, status, registration date
Customer information queries are optimized for fast lookups using indexed fields. They return essential account data needed for support interactions.
Retrieve customer order and transaction history:
Query Type: Order History
Input: customer_id, date_range (optional)
Returns: Orders, transactions, payment status
Order history queries support optional date filtering to limit results and improve performance. Results are paginated automatically to handle large datasets efficiently.
Access customer support interaction history:
Query Type: Support Tickets
Input: customer_id, status (optional), date_range (optional)
Returns: Support tickets, interactions, resolution status
Support ticket queries help you understand a customer's interaction history and identify patterns or recurring issues.
All N2CS queries follow strict read-only patterns. Understanding these patterns helps you work effectively within the system's constraints:
N2CS queries can only retrieve data. You cannot insert, update, or delete records through N2CS, ensuring system stability.
All queries require structured inputs (customer IDs, dates, status codes). This prevents SQL injection and ensures query safety.
You can only use searches that have been defined and approved by your administrator. CS can only select from admin-approved searches, ensuring controlled access to data.
Large result sets are automatically paginated to prevent performance issues and ensure responsive queries.
N2CS automatically optimizes queries for performance, but understanding how queries work helps you use them more effectively:
When possible, use the most specific identifier available. For example:
When querying historical data, always specify date ranges when available:
Good: Order History (last 30 days)
Avoid: Order History (all time)
Limiting date ranges reduces the amount of data processed and improves query response times.
N2CS allows you to combine multiple query types in a single request. This is more efficient than making separate queries:
Efficient Approach:
Single query: Customer Info + Recent Orders
Less Efficient:
Query 1: Customer Info
Query 2: Recent Orders
N2CS formats query results in a consistent, operational-friendly format:
When queries fail or return no results, N2CS provides clear error messages:
All errors are logged in the audit trail, helping administrators identify and resolve issues quickly.
Choose the query type that matches your information need. Don't use a broad query when a specific one will do.
Always include date ranges for historical queries to improve performance and relevance.
Use combined queries when you need multiple pieces of information about the same customer.
Take time to understand the structure of query results. This helps you find information faster in future queries.
When searches are executed, results are delivered to Slack (if configured). Every action is recorded in the audit log, providing full traceability. This ensures that CS teams can access customer data directly from their workflow tools.
Now that you understand query basics, you can: