Multiple Amazon Lex Posts

I have a bot that receives information from three apis. Right now I am collecting all this information in a message and sending it all at once:

{
sessionAttributes,
dialogAction: {
   type: 'Close',
   'Fulfilled',
   message
}

      

Is there a way to send information as it receives it? The end result will be three different messages one after the other without any input from the user.

+3


source to share


1 answer


This is impossible because of Lex. AWS Lex follows a request / response model and therefore will process responses directly related to a user's request. The recommended approach is aggregation, as you stated in your question.

However , depending on your integration strategy, you can send multiple messages bypassing Lex and send results from your APIs directly to the user.

eg.



  • User: "Hey Lex. Get my stuff."
  • Lex
    • Asynchornously calls every API
    • Replies to the user: "I'll send them to you now"
  • API 1 for the user: "Here is result 1"
  • API 2 to user: "Here is result 2"

This strategy will work with integrations like Slack, where messages can be retrieved over a single channel from multiple sources.

+1


source







All Articles