@cxbuilder/flow-config 2.1.1 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,319 +1,281 @@
1
- # @cxbuilder/flow-config
1
+ # FlowConfig for Amazon Connect
2
2
 
3
3
  [![CI/CD Pipeline](https://github.com/cxbuilder/flow-config/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/cxbuilder/flow-config/actions/workflows/ci-cd.yml)
4
4
  [![npm version](https://badge.fury.io/js/@cxbuilder%2Fflow-config.svg)](https://badge.fury.io/js/@cxbuilder%2Fflow-config)
5
5
  [![PyPI version](https://badge.fury.io/py/cxbuilder-flow-config.svg)](https://badge.fury.io/py/cxbuilder-flow-config)
6
6
  [![View on Construct Hub](https://constructs.dev/badge?package=%40cxbuilder%2Fflow-config)](https://constructs.dev/packages/@cxbuilder/flow-config)
7
7
 
8
- AWS CDK constructs for Amazon Connect FlowConfig - a third-party app for configuring variables and prompts in Connect contact flows.
8
+ **Empower your business users to manage Amazon Connect contact flow configurations without IT involvement.**
9
9
 
10
- ## Links
10
+ FlowConfig is a third-party app for Amazon Connect that lets business users update customer messages, queue settings, and routing variables in real-time—without touching contact flows or deploying code.
11
11
 
12
- - [Screenshots](./docs/screenshots/)
13
- - [Architecture](./docs/Architecture.md)
14
- - [DataModel](./docs/DataModel.md)
12
+ ![FlowConfig Admin View](./docs/screenshots/landing-admin.png)
15
13
 
16
- ## Installation
14
+ ## The Problem
17
15
 
18
- ```bash
19
- npm install @cxbuilder/flow-config
20
- ```
16
+ Your contact center needs to respond quickly to changing conditions:
21
17
 
22
- ## Usage
18
+ - 🚨 **Emergency closures** require immediate routing changes
19
+ - 🗓️ **Seasonal hours** need frequent prompt updates
20
+ - 🌍 **Multi-language support** means managing dozens of message variants
21
+ - 🏢 **Multiple locations** each need custom greetings and settings
22
+ - ⏱️ **Queue thresholds** must adapt to call volume fluctuations
23
23
 
24
- ### Standard Deployment (Public)
24
+ But every change requires:
25
+ - Opening Amazon Connect contact flow designer
26
+ - Finding and updating multiple text blocks
27
+ - Testing changes
28
+ - Deploying updates
29
+ - Waiting for IT availability
25
30
 
26
- ```typescript
27
- import { FlowConfigStack } from '@cxbuilder/flow-config';
28
- import * as cdk from 'aws-cdk-lib';
31
+ **There has to be a better way.**
29
32
 
30
- const app = new cdk.App();
31
- new FlowConfigStack(app, 'FlowConfigStack', {
32
- prefix: 'my-flow-config',
33
- env: {
34
- region: 'us-east-1',
35
- account: 'YOUR_ACCOUNT_ID',
36
- },
37
- cognito: {
38
- domain: 'https://your-auth-domain.com',
39
- userPoolId: 'us-east-1_YourPoolId',
40
- },
41
- connectInstanceArn:
42
- 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',
43
- alertEmails: ['admin@yourcompany.com'],
44
- });
45
- ```
33
+ ## The Solution
46
34
 
47
- ### VPC Private Deployment
35
+ FlowConfig separates **configuration** from **logic**. Your contact flow designers build reusable flows once, and business users manage the values that drive them.
48
36
 
49
- For enhanced security, you can deploy the application to run entirely within a VPC with private endpoints:
37
+ ### What You Can Configure
50
38
 
51
- ```typescript
52
- import { FlowConfigStack, VpcConfig } from '@cxbuilder/flow-config';
53
- import * as cdk from 'aws-cdk-lib';
39
+ **Variables** - Settings that control contact flow behavior:
40
+ - Boolean flags: `closure`, `offerCallback`, `holidayMode`
41
+ - Numbers: `maxWaitTime`, `queueDepth`, `transferTimeout`
42
+ - Text values: `skillLevel`, `routingMode`, `priority`
54
43
 
55
- const app = new cdk.App();
44
+ **Prompts** - Customer-facing messages:
45
+ - Multi-language support (English, Spanish, French, etc.)
46
+ - Separate voice and chat content
47
+ - Text-to-speech preview before going live
56
48
 
57
- // Configure VPC using string IDs - the stack will resolve these to CDK objects
58
- const vpcConfig: VpcConfig = {
59
- vpcId: 'vpc-12345678',
60
- lambdaSecurityGroupIds: ['sg-lambda123'],
61
- privateSubnetIds: ['subnet-12345', 'subnet-67890'],
62
- vpcEndpointSecurityGroupIds: ['sg-endpoint123'],
63
- };
49
+ ### Who Uses FlowConfig
64
50
 
65
- new FlowConfigStack(app, 'FlowConfigStack', {
66
- prefix: 'my-flow-config',
67
- env: {
68
- region: 'us-east-1',
69
- account: 'YOUR_ACCOUNT_ID',
70
- },
71
- cognito: {
72
- domain: 'https://your-auth-domain.com',
73
- userPoolId: 'us-east-1_YourPoolId',
74
- },
75
- connectInstanceArn:
76
- 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',
77
- alertEmails: ['admin@yourcompany.com'],
78
- vpc: vpcConfig, // Enable VPC private deployment
79
- });
80
- ```
51
+ **👔 Edit Users**
52
+ - Update all variables and prompts across all flow configurations
53
+ - Change settings during high-volume events or emergencies
54
+ - Update prompts for holidays, closures, and special events
55
+ - Preview voice messages before customers hear them
56
+ - Make changes instantly without IT involvement
81
57
 
82
- ### Multi-Region Global Table Deployment
58
+ **🔧 Administrators (Admin Access)**
59
+ - Create and organize flow configurations
60
+ - Define variable schema types (Text, Number, Boolean, Select)
61
+ - Add/remove variables and prompts
62
+ - Set up multi-language prompts for global operations
63
+ - Import/export configurations across environments
64
+ - Configure application settings (available locales and voices)
83
65
 
84
- For global resilience, deploy the application across multiple regions with DynamoDB Global Tables:
66
+ **👀 Read-Only Users**
67
+ - View all configurations and settings
68
+ - Monitor what messages customers are currently hearing
69
+ - Review variable values without editing capability
85
70
 
86
- #### Primary Region Setup
71
+ ## Quick Links
87
72
 
88
- ```typescript
89
- import { FlowConfigStack, GlobalTableConfig } from '@cxbuilder/flow-config';
90
- import * as cdk from 'aws-cdk-lib';
73
+ ### 📘 I'm a Business User
74
+ - [Edit User Guide](./docs/UserGuide-Edit.md) - Learn how to update variables and prompts
75
+ - [Administrator Guide](./docs/UserGuide-Admin.md) - Create and manage configurations
76
+ - [Read-Only User Guide](./docs/UserGuide-Read.md) - View configurations
91
77
 
92
- const app = new cdk.App();
78
+ ### 🛠️ I'm a Developer/Architect
79
+ - [Installation & Deployment](./docs/Installation.md) - Get started deploying FlowConfig
80
+ - [Architecture](./docs/Architecture.md) - Understand the technical design
81
+ - [Data Model](./docs/DataModel.md) - Explore the data structure
93
82
 
94
- // Primary region creates the global table with replicas
95
- const primaryGlobalTable: GlobalTableConfig = {
96
- isPrimaryRegion: true,
97
- replicaRegions: ['us-west-2', 'eu-west-1'],
98
- };
83
+ ### 🎯 I'm Evaluating This Solution
84
+ - [Screenshots](./docs/screenshots/) - See the interface in action
85
+ - [Use Cases](#common-use-cases) - Real-world scenarios below
86
+ - [Features](#key-features) - What's included
99
87
 
100
- new FlowConfigStack(app, 'FlowConfigStack-Primary', {
101
- prefix: 'my-flow-config',
102
- env: {
103
- region: 'us-east-1',
104
- account: 'YOUR_ACCOUNT_ID',
105
- },
106
- cognito: {
107
- domain: 'https://your-auth-domain.com',
108
- userPoolId: 'us-east-1_YourPoolId',
109
- },
110
- connectInstanceArn:
111
- 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',
112
- alertEmails: ['admin@yourcompany.com'],
113
- globalTable: primaryGlobalTable, // Enable global table
114
- });
115
- ```
88
+ ## Common Use Cases
116
89
 
117
- #### Secondary Region Setup
90
+ ### 🏢 Multi-Branch Operations
118
91
 
119
- ```typescript
120
- new FlowConfigStack(app, 'FlowConfigStack-Secondary', {
121
- prefix: 'my-flow-config',
122
- env: {
123
- region: 'us-west-2',
124
- account: 'YOUR_ACCOUNT_ID',
125
- },
126
- cognito: {
127
- domain: 'https://your-auth-domain.com',
128
- userPoolId: 'us-west-2_YourPoolId',
129
- },
130
- connectInstanceArn:
131
- 'arn:aws:connect:us-west-2:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',
132
- alertEmails: ['admin@yourcompany.com'],
133
- globalTable: {
134
- isPrimaryRegion: false, // Reference global table
135
- },
136
- });
137
- ```
92
+ **Challenge**: 50 branch offices, each with unique phone numbers and custom greetings, but sharing the same contact flow logic.
138
93
 
139
- ## Features
94
+ **Solution**: Create one flow configuration per branch (e.g., `branch-office-austin`, `branch-office-seattle`). Each branch gets custom prompts and settings while using a single, centralized contact flow design.
140
95
 
141
- - **Serverless Architecture**: Built with AWS Lambda, DynamoDB, and API Gateway
142
- - **Amazon Connect Integration**: GetConfig Lambda function integrated directly with Connect contact flows
143
- - **Third-Party App**: Web-based interface embedded in Amazon Connect Agent Workspace
144
- - **Multi-Language Support**: Configure prompts for different languages and channels (voice/chat)
145
- - **Real-time Preview**: Text-to-speech preview using Amazon Polly
146
- - **Secure Access**: Integration with Amazon Connect and AWS Verified Permissions
147
- - **Flexible Deployment Options**:
148
- - **Single-Region**: Standard deployment with regional DynamoDB table
149
- - **Multi-Region**: Global table support with automatic replication across regions
150
- - **Public Deployment**: Standard internet-accessible API Gateway and Lambda functions
151
- - **VPC Private Deployment**: Private API Gateway endpoints, VPC-enabled Lambda functions, and VPC endpoints for enhanced security
96
+ **Result**: Onboard new branches in minutes. Local staff can update their own greetings and settings without IT involvement.
152
97
 
153
- ## GetConfig Lambda Integration
98
+ ---
154
99
 
155
- The GetConfig Lambda function is used within contact flows to access your flow configs. This function is automatically integrated with your Amazon Connect instance during deployment.
100
+ ### 🚨 Emergency Response
156
101
 
157
- ### Contact Flow Event Structure
102
+ **Challenge**: Fire alarm requires immediate call center closure. Every minute of delay means confused customers and wasted agent time.
158
103
 
159
- The Lambda function handles Amazon Connect Contact Flow events with the following structure:
104
+ **Solution**: Business users open FlowConfig, toggle `closure: true`, and save. All new calls immediately hear the closure message and are routed appropriately.
160
105
 
161
- ```json
162
- {
163
- "Details": {
164
- "Parameters": {
165
- "id": "main-queue",
166
- "lang": "es-US"
167
- },
168
- "ContactData": {
169
- "Channel": "VOICE",
170
- "LanguageCode": "en-US"
171
- }
172
- }
173
- }
174
- ```
106
+ **Result**: Response time measured in seconds, not hours. No contact flow changes, no deployments, no IT tickets.
175
107
 
176
- ### Input Parameters and Priority
108
+ ---
177
109
 
178
- 1. **Required Parameters**:
110
+ ### 🌍 Global Customer Support
179
111
 
180
- - **`id`**: Flow configuration identifier (always required)
181
- - Provided via `Details.Parameters.id`
112
+ **Challenge**: Supporting customers in English, Spanish, and French requires managing hundreds of prompt variants across dozens of contact flows.
182
113
 
183
- 2. **Optional Language Selection** (in order of precedence):
114
+ **Solution**: Define prompts once in FlowConfig with all language variants. Contact flows automatically select the correct language based on customer preference.
184
115
 
185
- - `Details.Parameters.lang` (highest priority)
186
- - `Details.ContactData.LanguageCode`
187
- - Defaults to `"en-US"`
116
+ **Result**: Add a new language by updating prompts in FlowConfig—no contact flow changes required.
188
117
 
189
- 3. **Channel Detection**:
190
- - Automatically read from `Details.ContactData.Channel`
191
- - Supports `"VOICE"` and `"CHAT"`
192
- - Defaults to `"voice"`
118
+ ---
193
119
 
194
- ### Alternative Input Format (Testing)
120
+ ### 📊 Dynamic Queue Management
195
121
 
196
- For direct testing or non-Connect invocation:
122
+ **Challenge**: Call volume spikes require rapid adjustment of queue thresholds, wait times, and callback offerings.
197
123
 
198
- ```json
199
- {
200
- "id": "main-queue",
201
- "lang": "es-US",
202
- "channel": "voice"
203
- }
204
- ```
124
+ **Solution**: Business users adjust variables like `maxQueueDepth`, `maxWaitTime`, and `offerCallback` in real-time based on current conditions.
205
125
 
206
- ### Function Behavior
126
+ **Result**: Contact center supervisors respond to changing conditions without waiting for IT or risking contact flow mistakes.
207
127
 
208
- 1. **Parameter Resolution**:
128
+ ---
209
129
 
210
- - Extracts `id` from Connect event parameters (required)
211
- - Resolves language from parameters → attributes → default
212
- - Determines channel from Contact Flow event data
130
+ ## Key Features
213
131
 
214
- 2. **Processing Steps**:
132
+ **For Business Users:**
133
+ - ✅ **No-Code Interface** - Simple web UI embedded in Amazon Connect Agent Workspace
134
+ - 🎧 **Preview Before Publishing** - Hear exactly how prompts will sound using Amazon Polly text-to-speech
135
+ - 🌍 **Multi-Language Support** - Manage prompts in multiple languages with separate voice and chat content
136
+ - ⚡ **Instant Updates** - Changes take effect immediately for new customer contacts
137
+ - 🔒 **Role-Based Access** - Three access levels: Admin, Edit, and Read-Only
215
138
 
216
- - Retrieves the flow config from DynamoDB using the provided ID
217
- - Includes all variables from the flow config in the result
218
- - For each prompt in the flow config:
219
- - Selects the appropriate language version
220
- - Uses voice content by default
221
- - For chat channel:
222
- - Uses chat-specific content if available
223
- - Strips SSML tags from voice content if no chat content exists
139
+ **For IT Teams:**
140
+ - 🏗️ **Serverless Architecture** - Built on AWS Lambda, DynamoDB, and API Gateway
141
+ - 🔌 **Native Connect Integration** - Seamlessly integrates with contact flows via Lambda function
142
+ - 🔐 **Secure by Design** - AWS Cognito authentication with role-based access control
143
+ - 📦 **Easy Deployment** - Single CDK construct deploys the entire stack
144
+ - 🌐 **Flexible Architecture** - Supports single-region, multi-region, public, or VPC-private deployments
145
+ - 📤 **Import/Export** - Move configurations between environments (dev/test/prod)
224
146
 
225
- 3. **Output**:
226
- - Returns a flattened object containing:
227
- - All variable key-value pairs from the flow config
228
- - All prompt values resolved for the specified language and channel
147
+ ---
229
148
 
230
- ### Setting Up in Contact Flow
149
+ ## Getting Started
231
150
 
232
- 1. **Add "Invoke AWS Lambda function" block** to your contact flow
233
- 2. **Select the GetConfig Lambda function** (deployed as `${prefix}`)
234
- 3. **Configure parameters**:
151
+ ### For Developers
235
152
 
236
- ```json
237
- {
238
- "id": "main-queue"
239
- }
153
+ **Installation:**
154
+
155
+ ```bash
156
+ npm install @cxbuilder/flow-config
157
+ ```
158
+
159
+ **Basic Usage:**
160
+
161
+ ```typescript
162
+ import { FlowConfigStack } from '@cxbuilder/flow-config';
163
+ import * as cdk from 'aws-cdk-lib';
164
+
165
+ const app = new cdk.App();
166
+ new FlowConfigStack(app, 'FlowConfigStack', {
167
+ prefix: 'my-flow-config',
168
+ env: { region: 'us-east-1', account: 'YOUR_ACCOUNT_ID' },
169
+ cognito: {
170
+ domain: 'https://your-auth-domain.com',
171
+ userPoolId: 'us-east-1_YourPoolId',
172
+ },
173
+ connectInstanceArn: 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',
174
+ alertEmails: ['admin@yourcompany.com'],
175
+ });
240
176
  ```
241
177
 
242
- Or with explicit language:
178
+ **Next Steps:**
179
+ - See the [Installation Guide](./docs/Installation.md) for detailed deployment instructions
180
+ - Review the [Architecture](./docs/Architecture.md) to understand the technical design
181
+ - Explore advanced configurations (VPC private, multi-region, etc.)
182
+
183
+ ### For Contact Flow Designers
184
+
185
+ **Using FlowConfig in Your Contact Flows:**
186
+
187
+ 1. Add an "Invoke AWS Lambda function" block
188
+ 2. Select the GetConfig Lambda function (automatically deployed)
189
+ 3. Pass the configuration ID as a parameter:
243
190
 
244
191
  ```json
245
192
  {
246
- "id": "main-queue",
247
- "lang": "es-US"
193
+ "id": "main-queue"
248
194
  }
249
195
  ```
250
196
 
251
- ### Using Returned Data
252
-
253
- The Lambda response is automatically available in subsequent blocks:
197
+ 4. Use the returned values in subsequent blocks:
198
+ - Variables: `$.External.closure`, `$.External.maxWaitTime`
199
+ - Prompts: `$.External.welcome`, `$.External.holdMessage`
254
200
 
255
- - **Set contact attributes**: Use `$.External.variableName`
256
- - **Play prompt**: Use `$.External.promptName`
257
- - **Check contact attributes**: Reference returned variables for routing decisions
258
-
259
- ### Example Contact Flow Integration
201
+ **Example Flow:**
260
202
 
261
203
  ```
262
- [Get customer input] → [Invoke Lambda: GetConfig]
263
-
264
- [Set contact attributes]
265
-
266
- [Play prompt: $.External.welcomeMessage]
267
-
268
- [Route based on: $.External.routingMode]
204
+ [Entry Point] → [Invoke Lambda: GetConfig with id="main-queue"]
205
+
206
+ [Check: $.External.closure = true?]
207
+
208
+ [Yes: Play [No: Continue
209
+ $.External. to queue]
210
+ closureMessage]
269
211
  ```
270
212
 
271
- ### Size Considerations
213
+ For detailed Lambda integration instructions, see the [Technical Reference](#technical-reference) below.
272
214
 
273
- - Amazon Connect has a Lambda response size limit of 32KB
274
- - The combined size of returned variables and prompts should be less than this limit
275
- - For large flow configs with many prompts or languages, consider implementing pagination or selective loading
215
+ ---
276
216
 
277
- ### Logger
217
+ ## Technical Reference
278
218
 
279
- [Lambda PowerTools Logger](https://docs.powertools.aws.dev/lambda/typescript/latest/core/logger/) provides a lightweight logger implementation with JSON output.
219
+ ### GetConfig Lambda Integration
280
220
 
281
- Tips:
221
+ The GetConfig Lambda function is used within contact flows to access your flow configs. This function is automatically integrated with your Amazon Connect instance during deployment.
282
222
 
283
- - Use the `appendKeys()` method to add `ContactId` to your connect log lambda output.
223
+ **Lambda Parameters:**
284
224
 
285
- ### Open API Spec
225
+ - **Required**: `id` - The flow configuration identifier
226
+ - **Optional**: `lang` - Language code (defaults to contact's language or `en-US`)
227
+ - **Auto-detected**: `channel` - Voice or chat (detected from contact data)
286
228
 
287
- This template defines an Open API Spec for the API GW Lambdas. This allows use to generate a TypeScript api client to be used by the frontend app. We can also generate a API client in any language from the same spec to allow the client to better integrate with our apps.
229
+ **Lambda Response:**
288
230
 
289
- - [constructs/aws-openapigateway-lambda](https://docs.aws.amazon.com/solutions/latest/constructs/aws-openapigateway-lambda.html)
290
- - [OpenAPI Editor](https://marketplace.visualstudio.com/items?itemName=42Crunch.vscode-openapi)
291
- - [OpenApy TypeScript Generator](https://openapi-ts.pages.dev/introduction)
231
+ Returns a flattened object containing all variables and prompts from the configuration:
292
232
 
293
- ## Development
233
+ ```json
234
+ {
235
+ "closure": "false",
236
+ "maxWaitTime": "600",
237
+ "offerCallback": "true",
238
+ "welcome": "Thank you for calling...",
239
+ "holdMessage": "Please continue to hold..."
240
+ }
241
+ ```
294
242
 
295
- ### Frontend Development
243
+ **Key Behaviors:**
296
244
 
297
- The frontend React application integrates with Amazon Connect Agent Workspace using the Connect SDK:
245
+ - Automatically selects the correct language variant based on customer preference
246
+ - Returns chat-specific content for chat contacts (or strips SSML from voice content)
247
+ - Includes all variables as key-value pairs
248
+ - 32KB response size limit (Amazon Connect restriction)
298
249
 
299
- ```bash
300
- # Start local development server
301
- npm start
250
+ **Detailed Documentation:**
302
251
 
303
- # Build for production
304
- npm run build
305
- ```
252
+ For complete API documentation, event structures, and advanced usage, see:
253
+ - [Architecture Documentation](./docs/Architecture.md) - Full Lambda integration details
254
+ - [Data Model](./docs/DataModel.md) - Configuration structure and schemas
306
255
 
307
- For local development, point your Amazon Connect third-party app configuration to `localhost:3000`. The application requires execution within Agent Workspace for Connect SDK functionality.
256
+ ---
308
257
 
309
- ### Lambda Development
258
+ ## Development
310
259
 
311
- Lambda functions are bundled automatically during the build process:
260
+ For developers contributing to FlowConfig or customizing the deployment:
261
+
262
+ **Frontend Development:**
312
263
 
313
264
  ```bash
314
- # Bundle Lambda functions
315
- npm run build:lambdas
265
+ npm start # Local dev server
266
+ npm run build # Production build
267
+ ```
268
+
269
+ **Lambda Development:**
316
270
 
317
- # Full build (CDK + Frontend + Lambdas)
318
- npm run build
271
+ ```bash
272
+ npm run build:lambdas # Bundle Lambda functions
273
+ npm run build # Full build (CDK + Frontend + Lambdas)
319
274
  ```
275
+
276
+ **Additional Resources:**
277
+ - Uses [Lambda PowerTools](https://docs.powertools.aws.dev/lambda/typescript/latest/) for logging
278
+ - OpenAPI spec for API Gateway enables client generation in any language
279
+ - Frontend built with React and Amazon CloudScape Design System
280
+
281
+ For detailed development setup, see [Installation Guide](./docs/Installation.md).