- Newest
- Most votes
- Most comments
A candidate solution might be the following:
- Contact flow invokes a Lambda function that generates a Unique ID, invokes a step function and returns the Unique ID back to the flow. As far as Connect is concerned, the invoked lambda terminates immediately. Unique ID is stored as a contact attribute.
- The step function invokes a Lambda that performs the text to speech conversion and stores the output somewhere, together with the Unique ID (e.g. in a DynamoDB table)
- In the meanwhile your contact flow is periodically invoking a third Lambda that looks for the outcome for that unique ID (You would use Loop/Wait contact flow blocks)
As you're pointing out, the 8 seconds is a hardwired maximum, so I don't think you can work around it directly. If you'd like to share what the Lambda function does that takes so long, perhaps some of us here might have ideas on reducing the execution time.
Thanks for your response! I use the Lambda function to convert voice to text (by Transcribe), then that text return back to Amazon Connect and Play Prompt. Do you have any idea about that.
How long are the audio clips being transcribed? Have you tested if they really take that long to process in Transcribe, even when fed to it manually, or would it be possible that the Lambda function is spending much more time than the transcription would take to produce?
with 8s It's not possible to process voice and using Transcribe, sir. So now I find a solution to fix above limitation about time.
I don't think there's anything you can do about the 8-second time limit. If you only receive the audio to transcribe at the moment the Lambda function is called, then given the up to 3 retries Connect does when the Lambda fails, a potentially very messy hack would be for the first Lambda invocation to start the transcription in the background, to wait for it to complete until the initial timeout, and resume the wait in subsequent retries. Of course, it's a completely different topic whether the person on the other end is going to wait for tens of seconds for the step to complete.
The 8 seconds timeout is built-in with the intent to provide the best customer experience. If you leave the customer online to wait for 8+ seconds for a data dip or process to happen, not only you risk to have an unhappy customer, but you may actually create worse problems by orphaning processes that started and not completing, for example a payment transaction.
The approach will be available in a course over the next few weeks. It is not a hard wired one solution fits all, but the principle can be applied to your specific use cases. Use a Lambda function in a synchronous way to start an async process, and return right away to allow for further flow processing. The async Lambda should be coded to provide updates on the status periodically by using a DDB table for example. Depending on the use case, the flow can implement a loop with either music, or some educational info for the customers. A third Lambda (in the loop) checks the status update from the async function, and when the function completes it delivers the experience you expected. I hope this works for you. I would be curious to find out what is your use case for longer than 8 seconds backend queries.
Hello!
Kindly consider that there is an AWS Solution which has been available for a while already (2020 as per the blog post). You can quickly deploy it in your account:
https://aws.amazon.com/blogs/contact-center/use-asynchronous-lambda-functions-with-amazon-connect/
For your convenience, as I could see, the AWS solution basically uses three Lambda functions and a DynamoDB table as follows:
-
From contact flow, invoke a Lambda function that creates a record in a DynamoBD table with an unique ID (in this case contact ID) and input data. Then contact flow execution continues in step (3).
-
Asynchronous: DynamoDB table generates an event that invokes a new Lambda function which process input data and then after a "fake" delay it updates the record which include a field that indicates the processing status (used by next lambda function to know when processing was completed) and additional output data.
-
... From same contact flow and execution, using a Loop block, a new lambda function is invoked which gets record for the unique ID (contact ID) every 5 seconds and then in the contact flow it is evaluated if completed, incomplete, etc. A prompt with a 5 seconds delay is played within the loop iteration delay to achieve this, for example:
<speak>nothing yet. checking again in 5 seconds.<break time="5s"/></speak>
Hope it helps!
Relevant content
- asked 3 years ago
- AWS OFFICIALUpdated 10 months ago

Thank you, sir. I think it's possible to implement. Can you give me more about the technique to look for the outcome.
Have a look at this workshop: https://catalog.us-east-1.prod.workshops.aws/workshops/8c671acf-c521-4010-a509-7c3b06c3bb58/en-US/introduction/architecture. This might not be exactly your scenario, but close to (it uses a DynamoDB table to store execution results and a lambda to retrieve it later in the flow).