Google Assistant not listening using slot filling from Webhook - action

I'm having the current problem with Slot Filling in a Scene:
My desired behavior is: when I call an intent "participateSurvey", I call my Webhook that retrieves the live survey and fills dinamically a slot with the possibile options, then prompts the user that selects the option.
I've currently implemented it this way:
the intent "participateSurvey" redirects to the Scene "participateSurveyScene" which has a single slot "chosenOption", set as Required. In the console I set the flag "When you first prompt users.." to call my Webhook.
The Webhook fills the dynamic options and send this response
When testing I see that the Slot is correctly requested:
But using the Google Nest, when invoking the Intent after the response of the Webhook the Microphone is not opened, I've to say again "Ehi Google" and then answer and it's not great. This happens only if I go through my Webhook before the slot filling, which is what I need in this case.
Can someone please assist me? I'd like to open the microphone and listen to user answers automatically even when I prompt from the Webhook. Thanks in advance!

Related

Item updated via CSOM will not fire remote event receiver

We have a remote event receiver associated to a list and hooked on all events there. When you update any list item using OOB SharePoint page, the event receiver is executed; a web service which is taking care of the afterward actions works nicely. However when you update item use CSOM code e.g. in simple console application, nothing happens. The event receiver is not called at all. I found this issue on both SP 2013 and 2016.
I will not post any code while it is irrelevant: item is updated using standard approach and values are actually changed in the list item, only the event receiver is not fired. To put it simply:
item updated manually from site -> event receiver fired
item updated via CSOM -> event receiver not fired.
I remember similar issue on SharePoint 2010 when using server side code and system account. Could it be that behind the scene web service called by CSOM (e.g. list.asmx) is using system account to make changes as well? It's just hypothesis...
So after deeper investigation and many try/fails we found out it was indeed issue with code in our event receiver. For some strange reason original developers were checking Title field in after properties and cancelling code if not present. I guess it was probably an attempt to prevent looping calls.
One lesson learned: When using CSOM after event properties contains only those fields which were altered by CSOM code. Keep it in a mind in case you need to use other values than those you want to update. You may need to stupidly copy and assign them again just because of this.

Amazon Connect Contact Flow - Loop intents until user explicitly exits

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.

AWS Lex Simple Bot Statement / Intent

I was hoping to create an intent that only makes a statement to the user. I was thinking I could do this by having some utterances that trigger the intent with no slots, but with a "goodbye message". When I try to do that, when I save the intent, it deletes the goodbye message and reverts it to None. I also picked a "no-op" lambda function to call since it doesn't make sense for what I'm doing.
At this point, I'm not sure about how to do this, but it seems like the claudia-bot-builder has support for something like this, but I can't get it to deploy to my AWS account to see how it might do it.
Does anyone else here have an idea about how to have the bot just give information in response to an utterance instead of starting a dialog to retrieve information?
You can return simple messages to the user using only Amazon Lex Console without any Lambda Function selected.
Open your Lex Chat Bot in console.aws.amazon.com/lex/home....
1 Click the "Editor" Tab.
2 On the left, click on the Intent you want to return a message on.
3 On the right, scroll down to the "Fulfillment" section.
4 Click "Return parameters to client"
5 In "Response" section, type in the message(s) you want to respond with.
Note: Make sure the section "Lambda initialization and validation" is unchecked so that the intent goes directly to the "Fulfillment" response.

Call an action only once when it's called from two places

I have an app we have connected to Pubnub for a live socket service to keep data on the page fresh for the user.
I have an ajax call that will do something with our API, and when it is successful I call an action on the application controller. At or around the same time, as long as Pubnub is still connected it receives a message with the action handler name and it attempts to call the same action.
Ideally I want to make sure this code only runs once weather it was first called by Pubnub or by my ajax success callback. How can I do this maybe using the ember run loop? It seems viable here I'm just not able to wrap my head around how I would actually do this.
Well, I would only use the web socket.
But for your question:
There is not build-in functionality in the runloop to do that. You will need some kind of uniq message id, and then have a list of processed messages and check there before you run your code.

SignalR and one browser window for a session at a time

I have a situation where a user can modify an Excel like grid schedule online. I would like to be able to show a message stating that the schedule is being modified in another window. However, how can I do this with a window open, and if the previous window was closed with SignalR. For other sessions I just want to state another user is modifying the schedule.
It might be easiest to use localStorage to communicate between multiple tabs/windows a single user has open: http://www.codediesel.com/javascript/sharing-messages-and-data-across-windows-using-localstorage/
You can listen for the storage event which is triggered on every window a user has open on your site when you call localStorage.setItem or localStorage.removeItem.
Of course, it would still make sense to use SignalR to notify other users.
If you cannot use the localStorage API for some reason, you can still use SignalR to send a message to every window the user has open by using Clients.User(userName).... inside your Hub. By default, userName should match your user's IPrincipal.Identity.Name, but you can register your own IUserIdProvider to customize this: http://www.asp.net/signalr/overview/signalr-20/hubs-api/mapping-users-to-connections#IUserIdProvider