Skip to main content

@netforbpo/aws-cdk-aws-connect-lib

Project description

Amazon Connect L2 Construct library

License

This CDK Construct Library provides L2 constructs for Amazon Connect.

This is used in production internally. However, it is alpha and subject to breaking changes as better ways of managing resources are designed.

Package Installation

NPM

yarn add @netforbpo/aws-cdk-aws-connect-lib
# or
npm install @netforbpo/aws-cdk-aws-connect-lib

PyPI

uv add netforbpo-aws-cdk-aws-connect-lib
# or
pip install netforbpo-aws-cdk-aws-connect-lib

Basic Usage

Typescript

import * as connect from '@netforbpo/aws-cdk-aws-connect-lib';
import {
  aws_s3 as s3
} from '@aws-cdk';

// assuming `this` is your stack or other construct

const instance = new connect.Instance(this, 'myInstance', {
  identityManagementType: connect.IdentityManagementType.CONNECT_MANAGED,
  instanceAlias: 'my-instance-alias',
  telephonyConfig: {
    inboundCalls: true,
    outboundCalls: true,
  },
  otherConfig: {
    contactFlowLogs: true,
  }
});

const bucket = s3.Bucket(this, 'ConnectStorage');

instance.addStorageConfig(connect.SttorageConfig.buildS3(
    connect.StorageType.CALL_RECORDINGS,
    {
      bucket,
      prefix: 'call-recordings'
    }
));

Python

import aws_cdk_aws_connect_lib as connect
from aws_cdk import aws_s3 as s3

# Assuming `self` is your stack or other construct

self.instance = new connect.Instance(self, 'myInstance',
  identity_management_type=connect.IdentityManagementType.CONNECT_MANAGED,
  instance_alias='my-instance-alias',
  telephony_config=connect.TelephonyConfigProps(
    inbound_calls=True,
    outbound_calls=True,
  ),
  other_config=connect.OtherConfigProps(
    contact_flow_logs=True,
  )
)

self.bucket = s3.Bucket(stack, 'ConnectStorage')

self.instance.add_storage_config(
    connect.SttorageConfig.buildS3(
        resource_type=connect.StorageType.CALL_RECORDINGS,
        bucket=self.bucket,
        prefix='call-recordings'
    )
)

locating resources

Currently only Instance has a fromLookup method to build an Instance object from an previousl created connect instance (from another stack, or manually).

All the other resources can be used against that looked-up instance.

The ability to look up other resources will be added in the future once a PR gets merged into core aws-cdk ( aws/aws-cdk-cli#1015 ).

Example usage

import aws_cdk_aws_connect_lib as connect

self.instance = connect.Instance.from_lookup(self, 'myInstance',
    instance_name='my-instance-alias'
    # instance_arn and instance_id are also available
)

# Assuming self.bucket is an S3 bucket
self.instance.add_storage_config(
    connect.SttorageConfig.buildS3(
        resource_type=connect.StorageType.CHAT_TRANSCRIPTS,
        bucket=self.bucket,
        prefix='chat-transcripts'
    )
)

Associating Lex & Lambda bots

To associate a Lex Bot or Lambda Function to a connect instance there are two helper methods available on an instance (whether created or looked-up)

import aws_cdk_aws_connect_lib as connect

# and to associate a Lex Bot or Lambda Function to the connect instance

# Assuming self.lex_bot is a Lex Bot Alias
self.instance.associate_lex_bot('MyLexBot', self.lex_bot_alias)

# Assuming self.lambda_function is a Lambda Function or lambda function alias
self.instance.associate_lambda_function('MyLambda', self.lambda_function)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netforbpo_aws_cdk_aws_connect_lib-0.2.3.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file netforbpo_aws_cdk_aws_connect_lib-0.2.3.tar.gz.

File metadata

File hashes

Hashes for netforbpo_aws_cdk_aws_connect_lib-0.2.3.tar.gz
Algorithm Hash digest
SHA256 38daf00958baead278ee491c63d76f9a2e89d06db1d49d350a9e7f17f145d762
MD5 94fa01dcfb2d46e3752c3374fe936c8a
BLAKE2b-256 eaebd0504db0f52fc7d1a14bd385135f55ef19e10e9b6ec294b43f659d7bf411

See more details on using hashes here.

File details

Details for the file netforbpo_aws_cdk_aws_connect_lib-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for netforbpo_aws_cdk_aws_connect_lib-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e1b58750c205341e95066e6973ae4e3c4aca1ee8ec3bac5d231c02d2fe123f42
MD5 aa96e67fcf7cd0c2388e986e4cbdf76c
BLAKE2b-256 3053f7da8be88101e23d58952d8ae15ae199728125272709c0a459d3b9faa318

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page