IBM Watson Assistant - check for #sys-date with condition - ibm-cloud

In another Q&A you suggested me and I built the following conditions to check for legal age based on the birthday:
#sys-date.plusYears(18)<= today()
#sys-date.minusYears(18)<= today()
How can I add an additional condition that warns the user that he has not entered a correct date in the input and characters for having used only or even letters?

If you have a dialog node in IBM Watson Assistant with conditional responses and already have two conditions (old enough / too young), then you could add have a third response without any condition.
Conditions are checked in the order top down. If there is an unconditional answer, it serves like an ELSE. There you could respond with some help about the format.

Related

Smartsheet: Identifying location of a Column ID without a Sheet ID

We have a custom implementation of the SmartSheet Bridge which is returning the following error in our Run Log:
"The value for cell in column 3928364019935108, INPUT, did not conform to the strict requirements for type CHECKBOX."
The problem is we don't know which sheet this is occurring in which is making it hard to understand what the root cause of the problem is. Is there a way to identify the location of a column without a Sheet ID? Note we have six-thousand Sheets and it's not practical to do this manually.
The path of least resistance for you might be to contact Smartsheet support to explain your scenario and ask for their help in identifying the sheet.
If Smartsheet support is unable to assist, then you could write a script that'd programmatically iterate through all of the sheets that the specified account has access to doing the following for each sheet:
Issue a Get Column request the current sheet.
If the request succeeds, you've found the sheet that contains the specified column --> capture/output sheet ID and sheet name and exit the loop (end processing).
If the request fails (i.e., returns a 404 error code to indicate column not found), move on to the next sheet.
Note that if you're program needs to issue hundreds or thousands of Get Column requests before it finds the sheet and ends processing -- you'll need to insert pauses between batches of requests so that you don't get a rate limiting error (error code 429). The Smartsheet API docs contain info about rate limiting.
If you need help with the script, update your question with a language tag to indicate what language you're going to be using, and add a comment here on my answer. Depending on the language you're using, I may be able to provide more help regarding the specifics of the script.

IBM Watson Assistant - how to use input.text inside Slots

I am using IBM Watson Assistant for a chatbot. I have a dialog node with two slots. The first slot works fine. The node gets triggered and the bot asks for the first slot, since it is not present.
Then I would like to have the bot asking for the second slot. And the answer given should be stored in a $variable. I tried to achieve this with input.text, because I want to store every kind of input given there.
But instead of asking for the second slot the bot skips it and stores the answer given in slot one in the slot two $variable as well.
I guess it's because the bot also checks if input.text is present in slot one. To make it clear, I have not activated the 'prompt for everything' option.
How can I overcome this?
I am sure these screenshots of my test environment will make everything more clear:
This is because input.text as a check matches all input, so no matter what you enter your second slot will always be satisfied.
The way slots work is that it doesn't matter in which order the information is given or how much is given.
For Example: Say I have an ordering system looking for 'product', 'quantity', and 'delivery date'
The request 'I want spoons for the 3rd Feb'
Then two of the slots 'product' and 'delivery date' are satisfied and the output response will be for the prompt for the missing 'quantity' slot.
In your case you need to determine what information you are trying to gather. Is there an entity or an intent that is going to uniquely match the input. If so then you could use a slot. As a brute force match you can make the condition for the second slot more complex.
For example when looking for confirmation of an order you can add in the condition, which only triggers when all above slots have been completed, and you are looking to confirm whether you collected the instructions correctly.
(#yes || #no) && slot_in_focus
If this kind of approach doesn't fit your application then you should gather this information after the node for the slots.

Watson Assistant Chatbot saving user inputs in Slots

I'm using Watson Assistant Chatbot..I want to save a variable from the user input by enabling Slots and system entities like #sys-number.. I can save number by choosing check for #sys-number, or saving date by choosing check for #sys-date... But for text/characters I can't find something like #sys-text or #sys-char..
I tried to save text while check for #sys-number, but the answer is not saved into the variable and the question keep repeating in th chatbot console.
So, how can I use Slots to save text from user input, I mean what should I put in "check for", please?
Thanks,
Numbers are always numbers, no matter your language and context. Dates are always dates as well.
However, "texts" can mean many different things, and they depend on context. That's why you need to create a separate entity for each meaning in your context.
For IBM Watson Assistant, there is no reason to detect "any text" unless that text means something in your context.
Supposing you want to detect the word "smartphone". For Assistant, there is no reason to detect this word if it doesn't relate to any entity.
So, you need to create an entity (e.g. "#Product") and then give it a value named "smartphone". Then, whenever a user types "smartphone" in your Chatbot, Assistant will be able to recognize "#Product:smartphone".
In your Slots, in the "Check for" field, you can put "#Product". It means that if Chatbot doesn't detect any #Product (e.g. "smartphone"), it should repeat the question until it finds a valid product.

Bluemix Conversation, advancing the conversation

I have two conversation nodes defined. The first is triggered on conversation_start and asks the users's name. The second stores the user name from input.text in a context variable and asks if the user wants to take a brief survey or do something else. The second one never executes. What should the trigger be on the second one in order to advance the conversation? There is no intent or condition set yet. Basically, I just want to follow a string-of-pearls pattern where every question gets asked and let the user opt out of some of the questions.
there are two main ways to achieve this. The one I recommend is to create an intent for each possible way. For example, you could create an intent called #affirmative, with values like "Yes", "Yeah", "Sure", "Ok", etc. All you have to do is to create the intent and then use it in the condition field.
But you can also check the user's input directly, using input.text. For example, you could use input.text.toLowerCase() == 'yes' as the condition. Have in mind that this should only be used if you are controlling the input and only allowing a few possible values. If not, use an intent and let Watson Conversation handle the input parsing for you.
Another really cool feature that Watson Conversation provides that can benefit is you is to have a node with a condition like intents[0].confidence < 0.6 and a response like "Sorry, I didn't get that". That way you make sure your flow will only trigger a condition with a high confidence for the intent.
Hope it helps!
You can use the jump to function to route the system to arbitrary dialog_node - this is great for creating directed dialogs. So whenever you want to continue with the next question (user answered the previous question), you can use jump to from the node processing the answer to the previous question to ask the user another question (jump to the body part of the next dialog node asking new question).
Now for "get name" use case you want the second node gathering the name from the user input hanging off the conversation_start node. If the conversation encounters a node that has children, the processing of the next dialog round will start at the first child of this dialog node - this way the contextual dialogs are defined in the conversation.
Bluemix Conversation can be thought of as a state machine. Each transition is diagrammed in the tooling, but each node can only be triggered by a condition. So that if you're on a node asking a question, and the answer that comes back does not trigger one of the child nodes, the state will not transition to a child. Answers entered into a node are processed by Watson, who provides "intents", which are essentially keywords found in the sentence he just analyzed. So one way to advance the conversation is to match named "intents" using the # prefix to the trigger of in a child node. Another way it to match named "entities" using the # prefex, although it is less clear how Watson builds entities. The third way is to match context variables using the $ prefix and simple conditional operators such as ==. Context variables are entirely managed by you, the developer. You are allowed to set one context variable at each node. And then you can use it to trigger a child node. This appears to be a good approach to managing the type of conversation I want to implement. The fourth way is to use the previous parent node's input value using along with simple conditional operators.

Prevent Duplicate Google Form Submissions

I just built a Google Form for a registration system. I want to prevent duplicate submissions in the form but I don't want to use the option of "Only allow one response per person(Requires Login)" mainly because of the reason that it required login to a Google Account and I don't want that. I hope there could be a solution for the same using Google Apps Script but I am not much familiar with it. Hope if someone can help me out.
As far as I know, it'll be much easier to detect & remove duplicates in the results sheet, adding a column or using conditional formatting with a custom LOOKUP or MATCH formula to see if the same value is found in earlier rows/records.
At the moment, LOOKUP is giving me spurious results. MATCH works fine. I sometimes get very delayed results from conditional formatting, so I'd go for a new column with the formula (assuming email is in column A, and you're entering the formula in cell B2)
= NOT(ISERROR(MATCH(A2,A$1:A1,0)))
This will return TRUE for duplicates.