I made a quiz skill where a user is first prompted with a response from Alexa asking if they are ready to proceed. From there, the user must either say yes or no to activate a corresponding AMAZON.YesIntent or AMAZON.NoIntent respectively. The quiz then begins, and a user says an answer letter followed by the answer for each question. I use a server to simulate state within my skill.
Normally I start my skill by saying:
"Alexa, start Quiz Skill"
But, I am finding that simulating state using a server does not make a very robust voice interface for the Echo. If a user says:
"Alexa, ask Quiz Skill yes"
The skill will jump to whatever I have setup to trigger when Amazon detects an AMAZON.YesIntent. This is not what I want! I want the user to follow the flow of the skill I have set out.
Is there a way to govern what intents can be activated at what time? A thought I had was to use attributes to basically set what intents are allowed to be invoked next.
There is a session object on each Alexa request. That session object has a new property that is either true or false depending on whether it's a brand new session for your Skill.
If you happen to be using the alexa-sdk node module to build your skill you can also use a NewSession handler to catch the new session and divert flow to what ever event/intent you want interaction to begin at. More on the state handlers can be found on the github page here
While I don't think it is possible to enable/disable intents, you can certain change how they respond. It's easy to use the session object to keep track of what the last intent spoken was. Then your intent handler(s) can read the session object to see what the previous response was in order to choose how to respond.
In your example above, you might save the last question number to the session object. If 'yes' doesn't make sense based on the previous (or lack of) question, then your YesIntent handler could respond with "I'm sorry, I don't know what to do with that", or even maybe just ignore it and start the dialog from the beginning.
Related
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.
Could not find any current questions that solve my problem.
I am using the nodejs-howto sample from alexa tutorial. Located https://github.com/alexa/skill-sample-nodejs-howto.
I have followed the instructions for the Alexa-Hosted and was successful in creating the app.
I am using the alea simulator for testing via typing in the questions.
Problem: After asking the first question which does return the correct response. I then ask another question but the simulator seems to have closed my skill and the question is sent to the default alexa where of course my question does not exist. I have to re-invoke the skill after the first question.
My code is copy and pasted from the instruction from the above github link.
Thanks.
It seems your session is getting closed after the first response. Make sure that your intent response sets shouldEndSession as false
shouldEndSession
A boolean value that indicates what should happen after Alexa speaks
the response:
true: The session ends.
false: Alexa opens the microphone for a few
seconds to listen for the user's response. When you use false, include
a reprompt to give the user a second chance to respond.
null / undefined: Behavior depends on the type of device and the content of
the response. See Keep the Session Open.
EDIT : As per #R.Vait and #dan comments
Check whether a re-prompt is used and is properly configured.
I built the BookTrip bot from Amazon Lex detailed here.
When chatting with the bot the user can continue to book hotel rooms or rent cars until they end the conversation. Here is an example of a successful reservation followed by another reservation attempt through the chatbot interface:
When I use this chatbot in an Amazon Connect contact flow the user is not able to continue booking anything past the first reservation. Logically, the contact flow would keep executing the BookHotel or BookCar intents until the ConnectToAgent or EndConversation intents are executed.
I have tried looping BookHotel and BookCar back to the beginning of the "Get customer" input block but that errors out.
The best way to do this is keep the user in the bot until they have done all of their booking, and then exit back to Amazon Connect. You would do this in the following way:
Get slot values for initial booking
Use lambda to fullfil the intent (write to database, etc.) and clear the slot values
Use ConfrimIntent to as ask “would you like to add another booking”
If the user responds “yes”, confirming the intent then you would elicit the slot values (starting over at step 1)
If the user responds “no”, you would exit back to Amazon Connect
You can check out the lambda request and response details here
There is also a good discussion about this pattern on the AWS developer forum here.
I found one way around this that works for when you have multiple intents, though there are a couple drawbacks.
Basically, create a dummy block in Amazon Connect. I use Set Contact Attributes with a dummy attribute I named 'continue' with the value of 'continuing'. It is never used. Then on Success, loop it back to restart the Lex block!
No error when saving and publishing and works well for my use case.
Here's how the image above's set up works:
A. Play welcome prompt (this used to be the prompt when the Lex block initiated)
B. "Get customer input" is the Lex block.
C. Lex ends any intent and moves to dummy block (Set contact attributes)
D. On Success of setting dummy attribute, move back to restart B. Lex block.
Here are the drawbacks:
1. The Lex block requires some prompt when it initiates so you will have to design that into your bot, since it will deliver a prompt at the close of your intent, then another prompt at the restart of the Lex block.
2. This creates an infinite loop, at least until the user ends the call, or the session times out. One way around this though is to create an intent specifically for saying goodbye and don't point that intent fulfillment to the dummy block.
What I have implemented and successfully tested is adding "Greeting", "Yes" and "No" intents. When a real intent is fulfilled, I transfer the contact to the next Get customer input block that ask if the bot can help with anything else and checks for "Yes" and "No" intents. "Yes" transfers to the main Lex block. "No" obviously exits.
The key thing to me here is how do you set your text greetings so it doesn't seem confusing. Please see what I came up with on the flow diagram. Seems to be working to me.
P.S. Didn't test it in production.
Is there a way to clear/close a session in AWS Lex through the API call (boto3).
Say, the user is conversing with Lex bot which serves multiple intents. At some point, the user gives a negative answer to a prompt from the bot to abort the current intent. I am able to recognize that the user wants to talk about some other intent of the bot. I want a way to clear the current session through API call (Boto3) so that the bot is not expecting input for the closed intent.
Thanks.
There is no published API call for resetting the slot data and attributes of a Lex session, but you can always switch to a brand-new session. This is what the Console does when you click on "Clear chat history" in the "Test bot" interface. The abandoned session will time out in 5 min by default.
You can open a new session by submitting a new userId in the next call to PostText. This is one way to do it – every call will start a new session:
import uuid
boto3.client('lex-runtime').post_text(
botName='mybot',
botAlias = 'alphathree',
userId=uuid.uuid4().hex,
inputText="I want to order 5 gallons of ice cream")
I'm creating a web app for handling various surveys. An admin can create his own survey and ask users to fill it up. Users are defined by target groups assigned to the survey (so only user in survey's target group can fill the survey).
One of methods to define a target group is a "Token target group". An admin can decide to generate e.g. 25 tokens. After that, the survey can be accessed by anyone who uses a special link (containing the token of course).
So now to the main question:
Every token might have an e-mail address associated with itself. How can I safely send e-mails containing the access link for the survey? I might need to send a few thousand e-mails (max. 10 000 I believe). This is an extreme example and such huge mailings would be needed only occasionally.
But I also would like to be able to keep track of the e-mail message status (was it send or was there any error?). I would also like to make sure that the SMTP server doesn't block this mailing. It would also be nice if the application remained responsive :) (The task should run in background).
What is the best way to handle that problem?
As far as I'm concerned, the standard Django mailing feature won't be much help here. People report that setting up a connection and looping through messages calling send() on them takes forever. It wouldn't run "in background", so I believe that this could have negative impact on the application responsiveness, right?
I read about django-mailer, but as far as I understood the docs - it doesn't allow to keep track of the message status. Or does it?
What are my other options?
Not sure about the rest, but regardless for backgrounding the task (no matter how you eventually do it) you'll want to look for Celery
The key here is to reuse connection and to not open it again for each email. Here is a documentation on the subject.