Amazon Lex - Barge In - amazon-web-services

I have a Lex bot that is called from Amazon Connect. I have figured out how to allow barge-in from the Connect Get Customer Input. However, that's where it ends. When my Lexbot prompts for my slots, it isn't allowing the caller to barge-in. I figured that the session attribute set in Connect would carry the barge-in to the slots, but it doesn't. Is there a way to allow our callers to barge-in with the slot prompts?

You should be able to barge-in either using DTMF or voice. No configuration is required for DTMF and it should interrupt the prompt.
For voice barge-in, you need to set the session attributes in the Get Customer Input block as defined here. That is, the following attribute needs to be specified:
Key: x-amz-lex:barge-in-enabled:[intentName]:[slotToElicit]
Value: true
Specify the intentName and slotToElicit in the above key for which this functionality should be enabled. Note, wildcards (*) can be used here to enable this for multiple slots/intents.

Related

In Amazon LexV2, how do I disable barge-in (interruption event) for Fulfillment?

I have a LexV2 streaming voice bot that uses a Lambda function as a codehook for fulfillment of intents. Barge-in or interruption of the bot is enabled in the bot by default.
For queries where Lex inquires slot values or for Closing responses from Lex, I am able to disable barge-in from the console but the disable barge option doesn't exist for the cases where the Lambda function fulfills the intent and responds.
Is there any way through the console or any API that allows me to disable barge-in for fulfillment?
The Amazon Lex V2 Service Team confirmed that we will not able to disable barge-in feature if the response to be played to the end user is via their fulfillment lambda.
Barge-in or interruption of the bot is enabled by default for everything.
The "Users can interrupt the response when it is being read" (Barge-In) option in the console or the "allowInterrupt" options in the CreateIntent API are provided only for the static responses that are returned by Lex that include Fulfillment updates, Success response, Failure response, Timeout response and Closing responses.
Could you possibly use "x-amz-lex:allow-interrupt" set to False when calling your fulfillment Lambda code, and then in your main Lambda handler always reset this back to True (for when not in fulfillment mode)?
We did something very similar where we wanted allow-interrupt OFF for all elicit intent prompt messages, but on fallback in fallback handler, we allow the user to interrupt the ElicitIntent call from fallback, and we do that by setting x-amz-lex:allow-interrupt = True just for that fallback code.
We reset it back to False in the main Lambda handler entry point. Just a thought.
NOTE -- I attempted to show the wildcard asterisk in intentName / slotName fields for x-amz-lex:allow-interrupt, but it was stripped out in the comment. We use x-amz-lex:allow-interrupt:[ASTERISK]:[ASTERISK] in our above logic.

Amazon Connect Stop Call Recording

Is it possible to stop call recordings in Amazon Connect so the customer and agent can discuss sensitive material without being recorded?
I am aware of the set call recording behaviour blocks, but they don't seem to work on a call that has already been started with an agent with call recording enabled. Transferring to another contact flow with the recording type set to none doesn't seem to make a difference and the call carries on being recorded.
I am aware of the sample workflow Sample secure input with agent as outlined in this AWS blog https://aws.amazon.com/premiumsupport/knowledge-center/disable-recording-amazon-connect. This does work, however it relies on the customer entering payment details whilst the agent is on hold - preventing the agent and customer from having a sensitive conversation.
It seems the only way to stop recording once it has been enabled is to put the agent on hold?
Do not know if you have not solved your issue yet, but amazon has update their Amazon Connect API that would allow you to suspend the recording.
Boto3 implementation
response = client.suspend_contact_recording(
InstanceId='string',
ContactId='string',
InitialContactId='string'
)
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/connect.html#Connect.Client.suspend_contact_recording
They have also allow you to Start, Pause, Stop. (
We have just started to review this for a POC, turn recording off be default for a group of queues. Allow to Agents to start and stop and pause recording as needed.
You can also read this in an Amazon Blog post that should be able to help you fully implement the solution.
https://aws.amazon.com/blogs/contact-center/pausing-and-resuming-call-recordings-with-a-new-api-in-amazon-connect/#:~:text=is%20not%20recorded.-,End%20the%20call.,you%20start%20and%20stop%20it.
After speaking with Architects at AWS, the desired and designed for solution is to have the customer automatically enter sensitive information with the agent on hold and call recording turned off to remain PCI compliant.
If that is not an option there are workarounds possible that go against the way Amazon Connect has been designed. In order to turn off call recording once it has been enabled on a call, a new contact ID must be established. To do this you would need to transfer the user to your external phone number again or transfer to a queue and disable call recording in that new flow.
This brings in extra issues around how to get the customer back to the original agent once the sensitive information has been discussed. It also means you would potentially have 3+ contact IDs for the same transaction, with call recording spread across them.

Send push notifications/emails when a query/mutation happends in AppSync/Aurora

I am using AppSync with Aurora/RDS.
I would like that in some cases, when a query/mutation is sent to the db, then, after that, I want to send an email and push notification, but this should be detached from the query/mutation, that is, it does not matter if it fails or works.
At the moment I see all these options:
Can you tell me which one I should use?
Create a query that calls a lambda function that sends the
push/email and call it from the client once the actual
query/mutation is done. I don't like this because the logic is in
the client rather than the server. Seems easy to implement, and I
guess it is easy to ignore the result of the second operation from a
client point of view.
A variation of the previous one. Pack both operations in a single
network request. With GraphQL, that is easy, but I don't want the
client waits for the second operation. (Is it possible to create
lambda functions that return immediately, like a trigger of other
functions?)
Attach my queries/mutations to lambda functions instead of RDS
directly. Then, those lambda functions call other lambda functions
for notifications. Seems more difficult to program, but more
micro-services architecture friendly. Probably this is the best one,
not sure.
Use SQL triggers and call lambda functions from those triggers. I
don't know if this is even possible. Researching...
Use pipelines resolvers. The first one is the query/mutation, the
second one is the lambda function that sends the push/email. I would
say this is a bad option because I don't want the client to wait for
the second operation or manage the logic when the second resolver
fails.
Amazon RDS Events: It appears it is possible to attach lambda
functions to specific AWS RDS events.
https://docs.aws.amazon.com/lambda/latest/dg/services-rds.html It
seems it is about creating DBs, restoring... and that kind of
things. I don't see anything like creating a row, updating a row...
So, I discard this unless I am wrong.
Invoking a Lambda Function with an Aurora MySQL Stored Procedure
CALL mysql.lambda_async ( lambda_function_ARN,lambda_function_input )
https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.Lambda.html
"For example, you might want to send a notification using Amazon
Simple Notification Service (Amazon SNS) whenever a row is inserted
into a specific table in your database." That is exactly what I am
looking for. I like this idea, but I don't know if that is possible
with Aurora Serverless. Researching... It seems it is not possible
when using server-less:
https://www.reddit.com/r/aws/comments/a9szid/aurora_serverless_call_lambda/
Use step functions: No idea about how to use it.
Somehow, attach this lambda notification function to GraphQL/AppSync
instead of the database, but I guess it is not a good idea because I
need to read the database to the push notification token and the
email of the use who is going to receive the notifications.
Which method do you recommend me? I am using amplify cli.
Thanks a lot.
Currently AWS AppSync can only send notifications when the app is active. We are looking into implementation of the non active case.
If you want to send notifications when the app is not active, you can use the push notifications on iOS: silent push/interactive push or push notifications on Android.
If you want to send emails, voice/text message or notifications on phone when the app is not active, you can integrate with Amazon Pinpiont.

AWS Lex storage of audio

I’ve created a Lex bot that is integrated with an Amazon Connect work flow. The bot is invoked when the user calls the phone number specified in the Connect instance, and the bot itself invokes a Lambda function for initialisation & validation and fulfilment. The bot asks several questions that require the caller to provide simple responses. It all works OK, so far so good. I would like to add a final question that asks the caller for their comments. This could be any spoken text, including non-English words. I would like to be able to capture this Comment slot value as an audio stream or file, perhaps for storage in S3, with the goal of emailing a call centre administrator and providing the audio file as an MP3 or WAV attachment. Is there any way of doing this in Lex?
I’ve seen mention of ‘User utterance storage’ here: https://aws.amazon.com/blogs/contact-center/amazon-connect-with-amazon-lex-press-or-say-input/, but there’s no such setting visible in my Lex console.
I’m aware that Connect can be configured to store a recording in S3, but I need to be able to access the recording for the current phone call from within the Lambda function in order to attach it to an email. Any advice on how to achieve this, or suggestions for a workaround, would be much appreciated.
Thanks
Amazon Connect call recording can only record conversations once an agent accepts the call. Currently Connect cannot record voice in the Contact Flows. So in regards to getting the raw audio from Connect, that is not possible.
However, it looks like you can get it from lex if you developed an external application (could be lambda) that gets utterances: https://docs.aws.amazon.com/lex/latest/dg/API_GetUtterancesView.html
I also do not see the option to enable or disable user utterance storage in Lex, but this makes me think that by default, all are recorded: https://docs.aws.amazon.com/lex/latest/dg/API_DeleteUtterances.html

Invoke amazon lambda from amazon connect - wrong input?

I am trying to make a contact flow in amazon connect, in basic terms it should;
"Do you need support" -> Person: "Yes" -> "What is your name?" Person: "John doe", it should save "john doe" and send it to a lamba. this is how the contact flow looks like;
this is the code of my lambda;
error in CloudWatch,
Lambda;
connect;
I have tried a couple of different settings and variables in order to send the right value with it, and this is what is set as of right now;
I think you are using the wrong attribute type when sending the firstname to the lambda. From the type drop down you should select either: User Defined and then use firstname as the key and the value or just select Lex Slots and reference the same value you do in your Set Contact Attributes block.
Also not familiar with Java Lambdas, but I do know connect sends your lambda a JSON object and it looks like you have input set as a string. May be worth looking into that.
It depends, take into account different things:
1- You have to authorize amazon connect to trigger the lambda function.
2- You could send the data to lambda in different ways, for example if you have data in the same ContactFlow but it comes for previous part of the flow or store and send directly to lambda, see the image:
This is how we receive tc_date
And this is how we receive tc_numero but we send to a lambda that encrypts and tc_numero lives in the flow and we called how I show you in first image