Search code examples
pythonamazon-web-servicesaws-lambdachatbotamazon-lex

Integrate AWS Lex to website(lambda implemented in python runtime)


Im working on a bot and would like to integrate to a website for my project. My Bot is fully functional, lambda fulfillment coded in python runtime. I see example of how to integrate bot implemented in javascript(lambda node runtime) but not able to find help for python implementation.

Does my bot need to be implemented in javascript(lambda node runtime) to be able to integrate with website?

I not very familiar with UI stuff and any help to get me started is appreciated.


Solution

  • Your bot can be written in any language and still be integrated with a website.

    You can use an AWS SDK to access the bot or HTTPS calls.

    From the documentation for HTTPS calls:

    POST /bot/botName/alias/botAlias/user/userId/text HTTP/1.1
    Content-type: application/json
    
    {
       "inputText": "string",
       "requestAttributes": { 
          "string" : "string" 
       },
       "sessionAttributes": { 
          "string" : "string" 
       }
    }
    

    Or you can use an SDK. This can be done through the UI layer, using the JavaScript SDK; or through the website back-end, using the SDK that matches your backend. Here's the list of SDKs.

    You will be calling these methods from the Lex SDK to use your bot. PostContent is for sending voice, and PostText is for sending text. The response will contain the bots response.

    Hope that helps