Amazon Lex builds conversational interfaces using voice and text. Processing conversation logs enhances understanding of user intents and improves natural language capabilities of applications.

Welcome to the Amazon Lex documentation for Dimension! Integrating Dimension into your Amazon Lex application is quick and easy.

If you have any questions, comments, or suggestions, please feel free to contact us.

Create an API Key

Each chatbot or voice skill, needs its own API Key for tracking.

Add a Chatbot and select Lex as the Platform.

The Key will be used below as the value for DIMENSION_API_KEY in the instructions for sending logs to Dimension.

Create Cloudformation Stack [Optional]

In the steps below, you create a Cloudwatch Logs log-group, a IAM role with permissions for allowing lex to write to Cloudwatch Logs,
and a Lambda function with code we provide to feed conversation logs from Cloudwatch Logs to Dimension.

For convenience, we have also provided a Cloudformation file in the link below, which provides the same resources but with less flexibility
in customization.

After you create your cloudformation stack, attach the log-group and the role to the lex bot alias as instructed below.

Enable Conversation Logs on Amazon Lex

Step 1: Create a new Log Group in CloudWatch Logs.

For example, with the name “my-bot-text-logs”

Step 2: Create an IAM role and provide write permissions to the Log Group created above.

For example, with the name “MyBotLogRole”

Step 3: Enable Logs in Amazon Lex

  1. In the Lex console, select the chatbot
  2. Choose Settings
  3. Choose Conversation Logs
  4. Choose the Settings gear icon for Prod
  5. Under Log Type, select Text logs
  6. For Log Group name, select the group “my-bot-text-logs” created above
  7. For IAM role, select the role, “MyBotLogRole” created above
  8. Save

Integrate Amazon Lex Conversation Logs into Dimension

Now that conversations are being logged to Cloudwatch, configure a subscription to send these to Dimension.

  1. Navigate to AWS Lambda service on the Console.
  2. Choose Create function
  3. Provide a Function name such as lex-dimension-integration
  4. Choose the latest version of Node.js in the Runtime language
  5. Select Create new role with basic permissions
  6. Click on Create function
  7. In the function code select “Upload a file from Amazon S3” and enter this URL: https://dashbot-us-east-1-public-lex-cloudwatch-import.s3.amazonaws.com/f74c2e8da62424e6107afebb248acc4f
  8. In Environment variables, add DIMENSION_API_KEY with the Dimension API Key created above
  9. Click on Add trigger and add CloudWatch Logs in the trigger configuration
  10. Select the appropriate Log group from the drop down
    Note: Use the same CloudWatch Log group selected during Conversation logs setup
  11. Choose a Filter name and click Add

Test Integration

To test the integration, send messages to your chatbot.

Open Dimension reports, and from the Real Time section in the left nav, select Live Transcripts.

The messages should appear in the Live Transcripts.

If you have any questions, comments, or suggestions, please feel free to contact us.