How watson conversation should say good afternon based on time zone? - ibm-watson

If the user logins to the website in morning, watson would say Good Morning!
If the user logins to the website in afternoon, watson would say Good afternoon!
If the user logins to the website in evening, watson would say Good Evening!
I've written like this
{
"conditions": "now().before('12:00:00')",
"output": {
"text": {
"values": [ "Good morning!" ]
}
}
}
But after closing the json editor the code is changing to like this:
{
"output": {
"text": {
"values": [
"Good morning!"
]
}
}
}
Can anyone please say what the solution is? Please provide the entire code for
["good morning,good afternoon,good evening"]
`

You can't define conditions in the JSON editor. So it deletes any field that is not part of the schema.
You can set the condition within the tooling UI at the IF statement section. Just paste in your condition part. As the functionality has recently changed, you will need to do the following.
On the Welcome node, click the "Customise" Cog. Select "Allow multiple responses".
Set your conditions now at each response part.
If you are using the workspace API, then I recommend to export your workspace to see how a node block is correctly structured. Alternatively you can check the API spec.
https://www.ibm.com/watson/developercloud/conversation/api/v1/#create_workspace

Related

Alexa model evaluation works great but intent is never called in simulator or alexa device

I'm struggling to build my Alexa Interaction model. My application is used for requesting live data from a smart home device. All i do is basically calling my Server API with a Username & Password and i get a value in return. My interaction model works perfectly for requesting the parameters, for example i can say "Temperature" and it works perfectly fine across all testing devices. For that intent i got a custom RequestType.
However for setting up Username & Password i need to use an built-it slot type: AMAZON.NUMBER. As i only need numbers for my credentials this should work perfectly fine in theory.
I got a interaction model setup which works perfectly fine when i press "Evaluate Model" in Alexa developer console. However once i go to Test on the simulator or to my real Alexa device it's absolutely impossible to call the intent. It always calls one of more other intents? (I see this in the request JSON).
Here's how the intent looks:
{
"name": "SetupUsername",
"slots": [
{
"name": "username",
"type": "AMAZON.NUMBER"
}
],
"samples": [
"my user id is {username}",
"username to {username}",
"set my username to {username}",
"set username to {username}",
"user {username}",
"my username is {username}",
"username equals {username}"
]
}
Whatever i say or type in the Simulator, i cannot call this intent. I have no overlaps from other intents. Does anyone see an issue here?
Thank you in advance
EDIT: I just realized that if you want to do account linking on Alexa you need to implement OAuth2 - maybe my intents are never called because they want to bypass me implementing my own authentication?
UPDATE:
This is the intent that is usually called instead - it's my init intent. So for example is i say "my username is 12345" the following intent is gonna be called:
UPDATE 2:
Here is my full interaction model.
(HelpIntent and SetPassword are only for testing purposes, they don't make sense right now)
It's impossible calling SetupUsername with any of the samples in my model.
You need to build the interaction model. Saving is not enough
When you develop your Interaction Model, you have to save it AND build it. Otherwise only the evaluation model will work (documentation about it).
Then when you test in the test console, you should see in the JSON Input, at the bottom, which intent was called:
"request": {
"type": "IntentRequest",
"requestId": "xxxx",
"locale": "en-US",
"timestamp": "2021-10-20T14:38:59Z",
"intent": {
"name": "HelloWorldIntent", <----------- HERE
"confirmationStatus": "NONE"
}
}

Firebase realtime database phone security rules

I need some help with securing my database.
Those are my security rules:
I've tried this code to give access to each user to read and write his own data:
{
"rules": {
"Users":{
"$user":{
".read": "auth.token.phone_number==$user",
".write": "auth.token.phone_number==$user",
}
}
}
}
My database looks like this (i'm using phone numbers instead of uid):
but for some reason when I run the firebase rules playground with a given auth.token.phone number that equals to the exact location I gave for example i get read option denied.
and it happens also within my app with my app can you guys help me to solve it?
In provider type ::Choose Custom
And In payload use :
{
"provider": "anonymous",
"uid": "********",
"token":{
"phone_number":""
}
}
Rules are:
"$phone":{ ".read":"auth!==null && auth.token.phone_number===$phone", ".write":false } }
create a new data path admins and store the phone number as a child and do this. sorry if this didnt work as i am also a beginner
root.child('admins').child(auth.token.phone_number)

How to display a file when a user requires it in Watson-Conversation?

I would like to know how to display a file when a user types something.
Ex: Show me the course details
Output: The file(pdf format) which is on my PC gets displayed.
Basically, you need to know how to work conversation: is one API for creating Intents, Entities and your Dialog flow.
Your application will access all nodes with the return from the API, and you will create conditions to get something for know if the user asked something about "Show me the course details".
I recommend to you create one intent like #aboutCourse and show examples to Watson know if the user will ask something with this purpose.
Something like:
Watson says: Hi! How can I help you?
User: Please show me the course details
Watson will recognize your intent and response what you paste within the node with the Intent condition #aboutCourse.
Make sure if the user really want this with:
Watson says: You really want to know details about the course?
User: yes / ok // or something to confirm
Or you can add some Intent confidence level for this node condition like: intents[0].confidence >= 0.75
And your code will check if the Intent is #aboutCourse and the entity is #yes, and do something in your application.
Or, you can create one context variable too, because, depends on your node flow, the intents will modify within your flow because every time Watson try to recognize what the user wants.
With your dialog flow, you will create one context variable and check if user says yes, like:
{
"context": {
"courseConfirm": "<? #yes ?>" //create one intent with confirm examples and value equal yes
},
"output": {
"text": {
"values": [
"Ok, you say #yes. I'll check, one moment."
],
"selection_policy": "sequential"
}
}
}
And within your application:
function updateMessage(input, response) {
if (response.context.courseConfirm == 'yes') {
//do something with code with code
}
}
Or you can create one function inside my example, like this answer.
Obs.: This code example is with conversation-simple project, from IBM Developers, but you will do something like my example with the same logic:get the return from API and do something within your application.

Alexa skill Interaction Model unsure about custom slot

I brought an Amazon echo in hope to have it send commands to my HTPC.
I found and set up the following which uses alexa with eventghost.
http://www.eventghost.org/forum/viewtopic.php?f=2&t=7429&sid=c3d48a675d6d5674b25a35f4850bc920
The original poster used "literal" in the skill intent which I found doesn't work anymore. After reading through the whole thread I saw you need to create a custom slot type.
here is the skill set up
Intent scheme
{
"intents": [ {
"intent": "Run",
"slots": [
{
"name": "Action",
"type": "Commands"
} ]
} ]
}
Custom Slot Types
Commands
cleanup
clean up
move movies
move downloads
move cartoons
move the cartoons
move the downloads
move the downloaded movies
play
pause
stop
Sample Utterances
Run {Action}
What I'm wanting to do is say:
"Alexa tell/ask (Invocation Name) to clean up"
or
"Alexa tell/ask (Invocation Name) to Move movies"
I typed in the custom slot to what I believe is the correct format based on my web searching.
the problem is when I run it through Alexa it sometimes hits Eventghost slightly wrong.
how can I fine tune it. or do i have the skill set up wrong?
Above Setup Looks fine, Alexa skill has ability learn by training Skill more
But I dont know, you made typo error
Your Sample Utterances looks like "Alexa tell/ask (Invocation Name) clean up", but your ask as "Alexa tell/ask (Invocation Name) to clean up" with extra word as "to", if this is not an typo error, please remove word "to"
Because while pronunciation, the word "to" will try to combine with your commands

Multiple answers for a node in IBM Watson Conversation service

How I can specify multiple answers for a specific dialog node? For example, when user asks “What is your name”, my VA should reply “My name is Alexander”, or “You can call me Alexander”, or “Friends call me Alex”.
Maybe Conversation service must return a code and application checks the code and choose a random answer from answer's db.
For the application node that gives the response, select advanced mode and change to this:
{
"output": {
"text": {
"values": [
"My name is Alexander.",
"You can call me Alexander",
"Friends call me Alex"
],
"selection_policy": "random",
"append": false
}
}
}

Resources