# Amazon Lex

### Integrate Amazon Lex

1. Select *Resources* from your workspace menu and choose *Integrations* card
2. Click *+ Add integration* > Choose Amazon Lex from the *Type* dropdown
3. Provide your integration a name
4. Click the *IAMrole and Lex V2 Service Role* > This takes you to AWS where you can log into your account. The *Quick create stack* page appears with *Template*, *Stack Name,* and *Parameters* information
5. In the *Capabilities* section at the bottom of that page, select the acknowledgement checkbox > Click the *Create stack* button&#x20;
6. Once the stack is created, click the *Output* tab > Under the *Key* section, locate your newly-generated values for *LexManagementRoleArn* and *LexV2ServiceLinkedRoleArn*&#x20;
7. Copy and paste those values into NLX in the *IAM Role ARN* and *Lex Service Role ARN* fields respectively
8. Click *Create integration*

### Optional: Enabling Sentiment

There is an additional one-time setup required in order to enable permissions to detect sentiment using Amazon Lex.  This adds the Comprehend permissions to the Lex service linked role that is created by the NLX - Lex Integration.

1. [Build and deploy](https://docs.nlx.ai/platform/nlx-platform-guide/ai-applications/types/core#deployment) an application using the desired Amazon Lex integration
2. Go to the Lex service in your AWS Console > Select your application from the Bots table
3. Under *Deployment*, select *Aliases*
4. Select the TestBotAlias
5. Click Edit and Enable Sentiment Analysis (Note: If sentiment analysis is already enabled, disable it, save, and re-enable it)
6. To confirm permission was successfully added, check the service linked IAM role for the ComprehendPolicy
