My website is doing customer service & support ticket system.
But the way of integrating AWS lex seems not as easy as FB is.
The thing I wanna do is letting Lex Bot reply tickets for the customer on my website.
Do I need to learn AWS Lambda and API Gateway first for integrating Lex?
I want to know how to call the lex bot API in PHP curl.
As API Docs said.
But I am not sure why the POST url is like a relative path.
Anyway, thanks for the help.
Played around with AWS Lex a bit recently, and it seems that you cannot really avoid using Lambda code.
First the validation and fulfilment code hooks will be lambda functions and for any half-decent lex bot conversation you will need those.
Second is the chat client: if you do not want to use the existing list of native chatbot integrations (currently Facebok, Twilio SMS and Slack) you will need a custom implementation. A direct PHP curl might be an option (accessing the API directly), but I'd highly recommend using a standard AWS API Gateway / AWS lambda setup to create a lex client and use the convenience of SDKs instead. It's a very flexible setup, super easy. We have picked in up in days, with minimal python code base using boto3 SDK, with virtually no experience in python at all.
Hope it helps!
Custom implementation is the only way available to talk to lex from your website. However, it is not as complex as it sounds. The developer link here will help in implementation in js.
The only catch however is sharing aws credentials (IAM user) in your website code. This can also be avoided by getting temporary token from IAM, which would need further development effort.
To integrate lex bot to website, you need to know about AWS Lex runtime API, AWS IAM and Cognito configuration. This is the most secure way to integrate bot to website.
Here are the steps to add lex bot to your website:
1. Create new identity pool
From the Amazon Cognito console, you choose Manage new identity pool, and then choose Create new identity pool. You provide a pool name (testPoolName), choose Enable access to unauthenticated identities, and then choose Create Pool. Note down the identity pool id.
2. Give lex bot access permission to the identity pool
Go to IAM service. Select Roles. Look for Cognito_testPoolNameUnauth_Role. Click on Attach Policy. Search for AmazonLexRunBotsOnly and attach it.
3. Lex runtime call from website: Here is the sample code for the website
Fill in the identity pool id in the following code. To understand this code, you need to understand AWS Lex run time api.