Here is setup procedure of the AWS Lex with Lambda, Facebook Messenger. In this tutorial, using a BookTrip blueprint.
- Login to the AWS and goto Lex
- Click “Get started”
- Click “BookTrip”, Bot name is “BookTrip”, Child-directed is “No”. then “Create”
- Goto Lambda, “Create a Lambda function”. (If this is first time to create a function, screen image is different)
- Input “lex” into the filter windows, then choose “lex-book-trip-python”
- Click “Next”
- Input “Name” as “BookTrip”, Role is “Create new role from template(s)”, Role name as “BookTrip”, then click “Next”
- Click “Create function”
- Go back to Lex, and connect Lex and Lambda. BookCar Version change to “Latest”
- check “initialization and validation code hook” check box in the “Lambda initialization and validation”, and then BookTrip select in pulldown list.
- Check “AWS Lambda function” check box in the “Fulfillment”, and select BookTrip in pulldown list. then “Save intent”
- Build
- Goto “Setting” tab, Input Alias name as “Prod”, and Bot version as “Latest”. Click +
- Back to “Editor” tab and Click “Publish”, “Choose an alias” is set to “Prod”, then click “Publish”
- Repeat for “BookHotel” intent
- Goto Facebook and “create page”, input page name and “Get started”
- Goto “https://developers.facebook.com”, and select “Add a new app”
- Input Display name and contact e-mail, and then input CAPCHA.
- +Add product “Messenger” -> “Get started”
- Page select, and Page access token copy (Click) , memo it.
- Goto Settings -> Basic, click “Show” in the App Secret, after input password, you can get an app secret, memo it.
- Back to the Lex to connect Lex to Facebook, Goto Channel tab. Input Name, KMS Key, Alias, Verify Token, Page access token, App secret key, then click “Activate”
- Click “Copy” to copy the link of Callback URLs
- Back to the developers.facebook.com, click “Setup Webhooks”, pase Callback URLs, and input Verify Token, and check “messaging” and “messaging_postbacks”, click “Verify and Save”
- Select a page to subscribe … , select a page that you made, and then click “Subscribe”
- Back to Facebook page and send message. Bot will respond.