@cxbuilder/flow-config 2.1.0 → 2.2.0

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/.jsii CHANGED
@@ -3984,7 +3984,7 @@
3984
3984
  },
3985
3985
  "name": "@cxbuilder/flow-config",
3986
3986
  "readme": {
3987
- "markdown": "# @cxbuilder/flow-config\n\n[![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)\n[![npm version](https://badge.fury.io/js/@cxbuilder%2Fflow-config.svg)](https://badge.fury.io/js/@cxbuilder%2Fflow-config)\n[![PyPI version](https://badge.fury.io/py/cxbuilder-flow-config.svg)](https://badge.fury.io/py/cxbuilder-flow-config)\n[![View on Construct Hub](https://constructs.dev/badge?package=%40cxbuilder%2Fflow-config)](https://constructs.dev/packages/@cxbuilder/flow-config)\n\nAWS CDK constructs for Amazon Connect FlowConfig - a third-party app for configuring variables and prompts in Connect contact flows.\n\n## Links\n\n- [Screenshots](./docs/screenshots/)\n- [Architecture](./docs/Architecture.md)\n- [DataModel](./docs/DataModel.md)\n\n## Installation\n\n```bash\nnpm install @cxbuilder/flow-config\n```\n\n## Usage\n\n### Standard Deployment (Public)\n\n```typescript\nimport { FlowConfigStack } from '@cxbuilder/flow-config';\nimport * as cdk from 'aws-cdk-lib';\n\nconst app = new cdk.App();\nnew FlowConfigStack(app, 'FlowConfigStack', {\n prefix: 'my-flow-config',\n env: {\n region: 'us-east-1',\n account: 'YOUR_ACCOUNT_ID',\n },\n cognito: {\n domain: 'https://your-auth-domain.com',\n userPoolId: 'us-east-1_YourPoolId',\n },\n connectInstanceArn:\n 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',\n alertEmails: ['admin@yourcompany.com'],\n});\n```\n\n### VPC Private Deployment\n\nFor enhanced security, you can deploy the application to run entirely within a VPC with private endpoints:\n\n```typescript\nimport { FlowConfigStack, VpcConfig } from '@cxbuilder/flow-config';\nimport * as cdk from 'aws-cdk-lib';\n\nconst app = new cdk.App();\n\n// Configure VPC using string IDs - the stack will resolve these to CDK objects\nconst vpcConfig: VpcConfig = {\n vpcId: 'vpc-12345678',\n lambdaSecurityGroupIds: ['sg-lambda123'],\n privateSubnetIds: ['subnet-12345', 'subnet-67890'],\n vpcEndpointSecurityGroupIds: ['sg-endpoint123'],\n};\n\nnew FlowConfigStack(app, 'FlowConfigStack', {\n prefix: 'my-flow-config',\n env: {\n region: 'us-east-1',\n account: 'YOUR_ACCOUNT_ID',\n },\n cognito: {\n domain: 'https://your-auth-domain.com',\n userPoolId: 'us-east-1_YourPoolId',\n },\n connectInstanceArn:\n 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',\n alertEmails: ['admin@yourcompany.com'],\n vpc: vpcConfig, // Enable VPC private deployment\n});\n```\n\n### Multi-Region Global Table Deployment\n\nFor global resilience, deploy the application across multiple regions with DynamoDB Global Tables:\n\n#### Primary Region Setup\n\n```typescript\nimport { FlowConfigStack, GlobalTableConfig } from '@cxbuilder/flow-config';\nimport * as cdk from 'aws-cdk-lib';\n\nconst app = new cdk.App();\n\n// Primary region creates the global table with replicas\nconst primaryGlobalTable: GlobalTableConfig = {\n isPrimaryRegion: true,\n replicaRegions: ['us-west-2', 'eu-west-1'],\n};\n\nnew FlowConfigStack(app, 'FlowConfigStack-Primary', {\n prefix: 'my-flow-config',\n env: {\n region: 'us-east-1',\n account: 'YOUR_ACCOUNT_ID',\n },\n cognito: {\n domain: 'https://your-auth-domain.com',\n userPoolId: 'us-east-1_YourPoolId',\n },\n connectInstanceArn:\n 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',\n alertEmails: ['admin@yourcompany.com'],\n globalTable: primaryGlobalTable, // Enable global table\n});\n```\n\n#### Secondary Region Setup\n\n```typescript\nnew FlowConfigStack(app, 'FlowConfigStack-Secondary', {\n prefix: 'my-flow-config',\n env: {\n region: 'us-west-2',\n account: 'YOUR_ACCOUNT_ID',\n },\n cognito: {\n domain: 'https://your-auth-domain.com',\n userPoolId: 'us-west-2_YourPoolId',\n },\n connectInstanceArn:\n 'arn:aws:connect:us-west-2:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',\n alertEmails: ['admin@yourcompany.com'],\n globalTable: {\n isPrimaryRegion: false, // Reference global table\n },\n});\n```\n\n## Features\n\n- **Serverless Architecture**: Built with AWS Lambda, DynamoDB, and API Gateway\n- **Amazon Connect Integration**: GetConfig Lambda function integrated directly with Connect contact flows\n- **Third-Party App**: Web-based interface embedded in Amazon Connect Agent Workspace\n- **Multi-Language Support**: Configure prompts for different languages and channels (voice/chat)\n- **Real-time Preview**: Text-to-speech preview using Amazon Polly\n- **Secure Access**: Integration with Amazon Connect and AWS Verified Permissions\n- **Flexible Deployment Options**:\n - **Single-Region**: Standard deployment with regional DynamoDB table\n - **Multi-Region**: Global table support with automatic replication across regions\n - **Public Deployment**: Standard internet-accessible API Gateway and Lambda functions\n - **VPC Private Deployment**: Private API Gateway endpoints, VPC-enabled Lambda functions, and VPC endpoints for enhanced security\n\n## GetConfig Lambda Integration\n\nThe 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.\n\n### Contact Flow Event Structure\n\nThe Lambda function handles Amazon Connect Contact Flow events with the following structure:\n\n```json\n{\n \"Details\": {\n \"Parameters\": {\n \"id\": \"main-queue\",\n \"lang\": \"es-US\"\n },\n \"ContactData\": {\n \"Channel\": \"VOICE\",\n \"LanguageCode\": \"en-US\"\n }\n }\n}\n```\n\n### Input Parameters and Priority\n\n1. **Required Parameters**:\n\n - **`id`**: Flow configuration identifier (always required)\n - Provided via `Details.Parameters.id`\n\n2. **Optional Language Selection** (in order of precedence):\n\n - `Details.Parameters.lang` (highest priority)\n - `Details.ContactData.LanguageCode`\n - Defaults to `\"en-US\"`\n\n3. **Channel Detection**:\n - Automatically read from `Details.ContactData.Channel`\n - Supports `\"VOICE\"` and `\"CHAT\"`\n - Defaults to `\"voice\"`\n\n### Alternative Input Format (Testing)\n\nFor direct testing or non-Connect invocation:\n\n```json\n{\n \"id\": \"main-queue\",\n \"lang\": \"es-US\",\n \"channel\": \"voice\"\n}\n```\n\n### Function Behavior\n\n1. **Parameter Resolution**:\n\n - Extracts `id` from Connect event parameters (required)\n - Resolves language from parameters → attributes → default\n - Determines channel from Contact Flow event data\n\n2. **Processing Steps**:\n\n - Retrieves the flow config from DynamoDB using the provided ID\n - Includes all variables from the flow config in the result\n - For each prompt in the flow config:\n - Selects the appropriate language version\n - Uses voice content by default\n - For chat channel:\n - Uses chat-specific content if available\n - Strips SSML tags from voice content if no chat content exists\n\n3. **Output**:\n - Returns a flattened object containing:\n - All variable key-value pairs from the flow config\n - All prompt values resolved for the specified language and channel\n\n### Setting Up in Contact Flow\n\n1. **Add \"Invoke AWS Lambda function\" block** to your contact flow\n2. **Select the GetConfig Lambda function** (deployed as `${prefix}`)\n3. **Configure parameters**:\n\n```json\n{\n \"id\": \"main-queue\"\n}\n```\n\nOr with explicit language:\n\n```json\n{\n \"id\": \"main-queue\",\n \"lang\": \"es-US\"\n}\n```\n\n### Using Returned Data\n\nThe Lambda response is automatically available in subsequent blocks:\n\n- **Set contact attributes**: Use `$.External.variableName`\n- **Play prompt**: Use `$.External.promptName`\n- **Check contact attributes**: Reference returned variables for routing decisions\n\n### Example Contact Flow Integration\n\n```\n[Get customer input] → [Invoke Lambda: GetConfig]\n ↓\n [Set contact attributes]\n ↓\n [Play prompt: $.External.welcomeMessage]\n ↓\n [Route based on: $.External.routingMode]\n```\n\n### Size Considerations\n\n- Amazon Connect has a Lambda response size limit of 32KB\n- The combined size of returned variables and prompts should be less than this limit\n- For large flow configs with many prompts or languages, consider implementing pagination or selective loading\n\n### Logger\n\n[Lambda PowerTools Logger](https://docs.powertools.aws.dev/lambda/typescript/latest/core/logger/) provides a lightweight logger implementation with JSON output.\n\nTips:\n\n- Use the `appendKeys()` method to add `ContactId` to your connect log lambda output.\n\n### Open API Spec\n\nThis 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.\n\n- [constructs/aws-openapigateway-lambda](https://docs.aws.amazon.com/solutions/latest/constructs/aws-openapigateway-lambda.html)\n- [OpenAPI Editor](https://marketplace.visualstudio.com/items?itemName=42Crunch.vscode-openapi)\n- [OpenApy TypeScript Generator](https://openapi-ts.pages.dev/introduction)\n\n## Development\n\n### Frontend Development\n\nThe frontend React application integrates with Amazon Connect Agent Workspace using the Connect SDK:\n\n```bash\n# Start local development server\nnpm start\n\n# Build for production\nnpm run build\n```\n\nFor local development, point your Amazon Connect third-party app configuration to `localhost:3000`. The application requires execution within Agent Workspace for Connect SDK functionality.\n\n### Lambda Development\n\nLambda functions are bundled automatically during the build process:\n\n```bash\n# Bundle Lambda functions\nnpm run build:lambdas\n\n# Full build (CDK + Frontend + Lambdas)\nnpm run build\n```\n"
3987
+ "markdown": "# FlowConfig for Amazon Connect\n\n[![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)\n[![npm version](https://badge.fury.io/js/@cxbuilder%2Fflow-config.svg)](https://badge.fury.io/js/@cxbuilder%2Fflow-config)\n[![PyPI version](https://badge.fury.io/py/cxbuilder-flow-config.svg)](https://badge.fury.io/py/cxbuilder-flow-config)\n[![View on Construct Hub](https://constructs.dev/badge?package=%40cxbuilder%2Fflow-config)](https://constructs.dev/packages/@cxbuilder/flow-config)\n\n**Empower your business users to manage Amazon Connect contact flow configurations without IT involvement.**\n\nFlowConfig 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.\n\n![FlowConfig Admin View](./docs/screenshots/landing-admin.png)\n\n## The Problem\n\nYour contact center needs to respond quickly to changing conditions:\n\n- 🚨 **Emergency closures** require immediate routing changes\n- 🗓️ **Seasonal hours** need frequent prompt updates\n- 🌍 **Multi-language support** means managing dozens of message variants\n- 🏢 **Multiple locations** each need custom greetings and settings\n- ⏱️ **Queue thresholds** must adapt to call volume fluctuations\n\nBut every change requires:\n- Opening Amazon Connect contact flow designer\n- Finding and updating multiple text blocks\n- Testing changes\n- Deploying updates\n- Waiting for IT availability\n\n**There has to be a better way.**\n\n## The Solution\n\nFlowConfig separates **configuration** from **logic**. Your contact flow designers build reusable flows once, and business users manage the values that drive them.\n\n### What You Can Configure\n\n**Variables** - Settings that control contact flow behavior:\n- Boolean flags: `closure`, `offerCallback`, `holidayMode`\n- Numbers: `maxWaitTime`, `queueDepth`, `transferTimeout`\n- Text values: `skillLevel`, `routingMode`, `priority`\n\n**Prompts** - Customer-facing messages:\n- Multi-language support (English, Spanish, French, etc.)\n- Separate voice and chat content\n- Text-to-speech preview before going live\n\n### Who Uses FlowConfig\n\n**👔 Edit Users**\n- Update all variables and prompts across all flow configurations\n- Change settings during high-volume events or emergencies\n- Update prompts for holidays, closures, and special events\n- Preview voice messages before customers hear them\n- Make changes instantly without IT involvement\n\n**🔧 Administrators (Admin Access)**\n- Create and organize flow configurations\n- Define variable schema types (Text, Number, Boolean, Select)\n- Add/remove variables and prompts\n- Set up multi-language prompts for global operations\n- Import/export configurations across environments\n- Configure application settings (available locales and voices)\n\n**👀 Read-Only Users**\n- View all configurations and settings\n- Monitor what messages customers are currently hearing\n- Review variable values without editing capability\n\n## Quick Links\n\n### 📘 I'm a Business User\n- [Edit User Guide](./docs/UserGuide-Edit.md) - Learn how to update variables and prompts\n- [Administrator Guide](./docs/UserGuide-Admin.md) - Create and manage configurations\n- [Read-Only User Guide](./docs/UserGuide-Read.md) - View configurations\n\n### 🛠️ I'm a Developer/Architect\n- [Installation & Deployment](./docs/Installation.md) - Get started deploying FlowConfig\n- [Architecture](./docs/Architecture.md) - Understand the technical design\n- [Data Model](./docs/DataModel.md) - Explore the data structure\n\n### 🎯 I'm Evaluating This Solution\n- [Screenshots](./docs/screenshots/) - See the interface in action\n- [Use Cases](#common-use-cases) - Real-world scenarios below\n- [Features](#key-features) - What's included\n\n## Common Use Cases\n\n### 🏢 Multi-Branch Operations\n\n**Challenge**: 50 branch offices, each with unique phone numbers and custom greetings, but sharing the same contact flow logic.\n\n**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.\n\n**Result**: Onboard new branches in minutes. Local staff can update their own greetings and settings without IT involvement.\n\n---\n\n### 🚨 Emergency Response\n\n**Challenge**: Fire alarm requires immediate call center closure. Every minute of delay means confused customers and wasted agent time.\n\n**Solution**: Business users open FlowConfig, toggle `closure: true`, and save. All new calls immediately hear the closure message and are routed appropriately.\n\n**Result**: Response time measured in seconds, not hours. No contact flow changes, no deployments, no IT tickets.\n\n---\n\n### 🌍 Global Customer Support\n\n**Challenge**: Supporting customers in English, Spanish, and French requires managing hundreds of prompt variants across dozens of contact flows.\n\n**Solution**: Define prompts once in FlowConfig with all language variants. Contact flows automatically select the correct language based on customer preference.\n\n**Result**: Add a new language by updating prompts in FlowConfig—no contact flow changes required.\n\n---\n\n### 📊 Dynamic Queue Management\n\n**Challenge**: Call volume spikes require rapid adjustment of queue thresholds, wait times, and callback offerings.\n\n**Solution**: Business users adjust variables like `maxQueueDepth`, `maxWaitTime`, and `offerCallback` in real-time based on current conditions.\n\n**Result**: Contact center supervisors respond to changing conditions without waiting for IT or risking contact flow mistakes.\n\n---\n\n## Key Features\n\n**For Business Users:**\n- ✅ **No-Code Interface** - Simple web UI embedded in Amazon Connect Agent Workspace\n- 🎧 **Preview Before Publishing** - Hear exactly how prompts will sound using Amazon Polly text-to-speech\n- 🌍 **Multi-Language Support** - Manage prompts in multiple languages with separate voice and chat content\n- ⚡ **Instant Updates** - Changes take effect immediately for new customer contacts\n- 🔒 **Role-Based Access** - Three access levels: Admin, Edit, and Read-Only\n\n**For IT Teams:**\n- 🏗️ **Serverless Architecture** - Built on AWS Lambda, DynamoDB, and API Gateway\n- 🔌 **Native Connect Integration** - Seamlessly integrates with contact flows via Lambda function\n- 🔐 **Secure by Design** - AWS Cognito authentication with role-based access control\n- 📦 **Easy Deployment** - Single CDK construct deploys the entire stack\n- 🌐 **Flexible Architecture** - Supports single-region, multi-region, public, or VPC-private deployments\n- 📤 **Import/Export** - Move configurations between environments (dev/test/prod)\n\n---\n\n## Getting Started\n\n### For Developers\n\n**Installation:**\n\n```bash\nnpm install @cxbuilder/flow-config\n```\n\n**Basic Usage:**\n\n```typescript\nimport { FlowConfigStack } from '@cxbuilder/flow-config';\nimport * as cdk from 'aws-cdk-lib';\n\nconst app = new cdk.App();\nnew FlowConfigStack(app, 'FlowConfigStack', {\n prefix: 'my-flow-config',\n env: { region: 'us-east-1', account: 'YOUR_ACCOUNT_ID' },\n cognito: {\n domain: 'https://your-auth-domain.com',\n userPoolId: 'us-east-1_YourPoolId',\n },\n connectInstanceArn: 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',\n alertEmails: ['admin@yourcompany.com'],\n});\n```\n\n**Next Steps:**\n- See the [Installation Guide](./docs/Installation.md) for detailed deployment instructions\n- Review the [Architecture](./docs/Architecture.md) to understand the technical design\n- Explore advanced configurations (VPC private, multi-region, etc.)\n\n### For Contact Flow Designers\n\n**Using FlowConfig in Your Contact Flows:**\n\n1. Add an \"Invoke AWS Lambda function\" block\n2. Select the GetConfig Lambda function (automatically deployed)\n3. Pass the configuration ID as a parameter:\n\n```json\n{\n \"id\": \"main-queue\"\n}\n```\n\n4. Use the returned values in subsequent blocks:\n - Variables: `$.External.closure`, `$.External.maxWaitTime`\n - Prompts: `$.External.welcome`, `$.External.holdMessage`\n\n**Example Flow:**\n\n```\n[Entry Point] → [Invoke Lambda: GetConfig with id=\"main-queue\"]\n ↓\n [Check: $.External.closure = true?]\n ↓ ↓\n [Yes: Play [No: Continue\n $.External. to queue]\n closureMessage]\n```\n\nFor detailed Lambda integration instructions, see the [Technical Reference](#technical-reference) below.\n\n---\n\n## Technical Reference\n\n### GetConfig Lambda Integration\n\nThe 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.\n\n**Lambda Parameters:**\n\n- **Required**: `id` - The flow configuration identifier\n- **Optional**: `lang` - Language code (defaults to contact's language or `en-US`)\n- **Auto-detected**: `channel` - Voice or chat (detected from contact data)\n\n**Lambda Response:**\n\nReturns a flattened object containing all variables and prompts from the configuration:\n\n```json\n{\n \"closure\": \"false\",\n \"maxWaitTime\": \"600\",\n \"offerCallback\": \"true\",\n \"welcome\": \"Thank you for calling...\",\n \"holdMessage\": \"Please continue to hold...\"\n}\n```\n\n**Key Behaviors:**\n\n- Automatically selects the correct language variant based on customer preference\n- Returns chat-specific content for chat contacts (or strips SSML from voice content)\n- Includes all variables as key-value pairs\n- 32KB response size limit (Amazon Connect restriction)\n\n**Detailed Documentation:**\n\nFor complete API documentation, event structures, and advanced usage, see:\n- [Architecture Documentation](./docs/Architecture.md) - Full Lambda integration details\n- [Data Model](./docs/DataModel.md) - Configuration structure and schemas\n\n---\n\n## Development\n\nFor developers contributing to FlowConfig or customizing the deployment:\n\n**Frontend Development:**\n\n```bash\nnpm start # Local dev server\nnpm run build # Production build\n```\n\n**Lambda Development:**\n\n```bash\nnpm run build:lambdas # Bundle Lambda functions\nnpm run build # Full build (CDK + Frontend + Lambdas)\n```\n\n**Additional Resources:**\n- Uses [Lambda PowerTools](https://docs.powertools.aws.dev/lambda/typescript/latest/) for logging\n- OpenAPI spec for API Gateway enables client generation in any language\n- Frontend built with React and Amazon CloudScape Design System\n\nFor detailed development setup, see [Installation Guide](./docs/Installation.md).\n"
3988
3988
  },
3989
3989
  "repository": {
3990
3990
  "type": "git",
@@ -4614,6 +4614,6 @@
4614
4614
  "symbolId": "infrastructure/FlowConfigStack:LambdaVpcConfig"
4615
4615
  }
4616
4616
  },
4617
- "version": "2.1.0",
4618
- "fingerprint": "7APV1MU2k9Svjp7XOp134U/3dAVzzVbNCFw80BjrU/4="
4617
+ "version": "2.2.0",
4618
+ "fingerprint": "6WPcPSRUzC+hMn+d1SfSmI9j9QlpS8PgRaOBgzdfCcM="
4619
4619
  }
package/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.2.0] - 2025-12-02
9
+
10
+ - Admins can control the variable type
11
+ - Added role based user guides
12
+
13
+ ## [2.1.1] - 2025-10-08
14
+
15
+ - Fixed `associate3pApp` prop reference in `associate3pApp()` method to properly read from props
16
+ - Added Unit tests for FlowConfigStack to verify `associate3pApp` configuration behavior
17
+
8
18
  ## [2.1.0] - 2025-10-08
9
19
 
10
20
  - Added `associate3pApp` stack prop which allow you turn off the automatic Agent Workspace app association
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).