Amazon Connect AWS CDK

Amazon Connect is a cloud-based contact center service provided by Amazon Web Services (AWS). It allows businesses to easily set up and manage a contact center in the cloud, providing a flexible and scalable solution for customer support, sales, and service.

With Amazon Connect, businesses can create virtual contact centers that can handle voice, chat, and email interactions with customers. It provides a set of tools and features that enable businesses to create personalized customer experiences, while also improving agent productivity and efficiency.

Key features of Amazon Connect:

  • Interactive Voice Response (IVR): Enables customers to self-serve by navigating through menus and selecting options using their phone’s keypad or voice commands.
  • Automatic Call Distribution (ACD): Routes incoming calls to the appropriate queue or agent based on pre-defined criteria, such as skill set, language, or customer history.
  • Call recording and transcription: Records and transcribes calls for quality assurance and compliance purposes.
  • Real-time and historical analytics: Provides real-time and historical data about call center performance, such as queue metrics, agent activity, and customer feedback.
  • Integration with other AWS services: Integrates with other AWS services, such as Amazon S3, Amazon Kinesis, and Amazon Lex, to provide additional functionality and customization options.

To create routing profiles, phone numbers, and contact flows in Amazon Connect using AWS CDK, you can use the appropriate constructs provided by the aws-cdk-lib/aws-connect package.

Here’s an example CDK script that creates a routing profile, phone number, and contact flow:

//typescript
//
import * as cdk from 'aws-cdk-lib';
import * as connect from 'aws-cdk-lib/aws-connect';

const app = new cdk.App();

const stack = new cdk.Stack(app, 'AmazonConnectStack', {
  env: { account: '<your_aws_account_id>', region: 'us-west-2' },
});

// Define the Amazon Connect instance
const instance = new connect.CfnInstance(stack, 'MyConnectInstance', {
  identityManagementType: 'CONNECT_MANAGED',
  inboundCallsEnabled: true,
  instanceAlias: 'my-connect-instance',
  tags: {
    Name: 'My Amazon Connect Instance',
  },
});

// Define the routing profile
const routingProfile = new connect.CfnRoutingProfile(stack, 'MyRoutingProfile', {
  name: 'My Routing Profile',
  defaultOutboundQueueId: 'arn:aws:connect:us-west-2:<your_aws_account_id>:instance/<instance_id>/queue/<queue_id>',
  queueConfigs: [{
    priority: 1,
    queueReference: {
      id: 'arn:aws:connect:us-west-2:<your_aws_account_id>:instance/<instance_id>/queue/<queue_id>',
    },
  }],
});

// Define the phone number
const phoneNumber = new connect.CfnPhoneNumber(stack, 'MyPhoneNumber', {
  phoneNumber: '+1234567890',
  instanceId: instance.ref,
  productType: 'SIP',
  routingProfileId: routingProfile.ref,
  tags: {
    Name: 'My Phone Number',
  },
});

// Define the contact flow
const contactFlow = new connect.CfnContactFlow(stack, 'MyContactFlow', {
  name: 'My Contact Flow',
  type: 'CONTACT_FLOW',
  content: JSON.stringify({
    version: '13.0',
    start: {
      id: 'f33c6eeb-4131-470c-93d6-f8117f464a0a',
      type: 'Standard',
      branches: [],
      parameters: {},
    },
  }),
});

// Output the phone number ARN and contact flow ARN
new cdk.CfnOutput(stack, 'MyPhoneNumberArn', { value: phoneNumber.attrArn });
new cdk.CfnOutput(stack, 'MyContactFlowArn', { value: contactFlow.attrArn });

In this example, we define a routing profile using the CfnRoutingProfile construct, setting the name and default outbound queue. We also specify a priority and queue reference for the routing profile.

Next, we define a phone number using the CfnPhoneNumber construct, setting the phone number, instance ID, product type, and routing profile ID. We also set a name for the phone number using tags.

Finally, we define a contact flow using the CfnContactFlow construct, setting the name and content of the contact flow. We also output the ARNs for the phone number and contact flow using the CfnOutput construct, allowing us to easily access them for use in other parts of our application.

By using AWS CDK to define and create these resources, we can ensure that our Amazon Connect infrastructure is created and configured in a consistent and repeatable way, making it easier to manage and maintain over time.