Playground project to test the aws lex bot platform.
- lex
- bot
- intents
- slots
- lambdas
- entrypoint
- validation
- fullfilment
- api
- scripts
AWSTranslate
^
|
V
Platforms --> API Gateway --> EntrypointLambda --> AWSLexBOT
(ex: messenger) || |
connectors |
|
V
DialogLambda <--> Intent <--> FulfillmentLambda
||
slotTypes
-
Facebook
- Edit json files inside
lex/
sub-folders to edit bot, intents and slots - Edit js files inside
lambdas/
folder to edit validation and fulfillment bot functions- Add aws resource permissions to
package.json
config.permissions array of each lambda function
- Add aws resource permissions to
- Edit json files inside
api/
folder to edit api gateway configurations - Copy
.env.example
to.env
and replace environment variables values
-
npm run put:lambda -- <lambdaName>
-
npm run put:slot -- <slotName>
-
npm run put:intent -- <intentName>
-
npm run put:bot -- <botName>
-
npm run put:api -- <apiGatewayName>
-
npm run put:role -- <roleName> <AWSService> [<AWSPolicy1> <AWSPolicy2> ... <AWSPolicyN>]
-
Edit
scripts/deploy.js
file -
Run
npm run deploy
After deploy, you can delete all created resources on AWS with
npm run clean
Add API Gateway live URL to the platform configuration dashboard (ex: Facebook Messenger Platform Webhook)
Amazon Resource Name (ARN): arn:aws:SERVICE:REGION:ACCOUND_ID:RESOURCE_PATH/RESOURCE_ID
ARN string examples:
- Lambda function:
arn:aws:lambda:eu-west-1:123456789:function:OrderFlowersEntrypointLambda
- API Gateway:
arn:aws:apigateway:eu-west-1:123456789:1234567
- Policy:
arn:aws:iam::aws:policy/AWSLambdaExecute
- Role:
arn:aws:iam::123456789:role/myRoleName
An IAM role is an IAM identity that you can create in your account that has specific permissions.
You can use roles to delegate access to users, applications, or services that don't normally have access to your AWS resources.
You manage access in AWS by creating policies and attaching them to IAM identities (Users or Roles) or AWS resources (Lambdas, API Gateways, ...)
Policy JSON example:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:*"
],
"Resource": "arn:aws:logs:*:*:*"
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::*"
}
]
}