Introduction
Welcome to the documentation for creating AWS Lex bots to use with MoyaApp Messenger API. If you run into any issues, or have questions or feedback, please let us know by sending a message to api-support@moya.app.
Creating bot with Amazon Lex
Please refer to the AWS Lex documentation for examples of how to create a chat bot on Amazon LEX V2.
Integrating Chatbot with Messaging API
Required Parameters
The following parameters will be required to integrate the newly created bot with Moya messaging platform.
Phone number: The phone number to listen on
moya_auth_token
: If you already have a messaging account with us and wish to plug AWS Lex into this please provide us with it. If not then we will generate one on the phone number specified above.AWS Region Name: The AWS region that hosts the Amazon Lex bot
aws_access_key_id
&aws_secret_access_key
: Required for messaging API to access the bot. To generate access key and secret key, please see the AWS documentationbot_id
: Required to identify the bot. To access the bot id, open Lex console and select your bot. Under the Bot details sectionbot_alias
: Required to invoke the correct bot. Bot alias id can be accessed from the aliases section of the bot.
AWS Lex to MoyaApp setup
Once all the parameters above are ready please email them to api-support@moya.app
Interacting with Chatbot
In order to interact with and test the chatbot you can send a message to the API phone number. You can also test the chatbot by sending a curl request.
Example Request
curl -X 'POST' \
'https://lex-gateway.moya.app/webhook/<lex bot phone number>' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"message":
{
"type":"text",
"from":"number to receive response",
"text":
{
"body":"chatbot wake word/phrase"
}
}
}'
Example Response
{
"message": "success"
}