I am failing to understand the simple passing of parameters to and fro via webhook. i am trying to build a simple bot using dialog flow and fb messenger. i have requirement to show two buttons to the end user to pick a cake type. i am able to show the options using the below custom response:
{
"facebook": {
"attachment": {
"type": "template",
"payload": {
"template_type": "button",
"text": "What kind of cake would you like?",
"buttons": [
{
"type": "postback",
"payload": "witheggs",
"title": "Contain Eggs"
},
{
"type": "postback",
"payload": "noeggs",
"title": "Eggless"
}
]
}
}
}
}
once user tap one of the two buttons then how do i set it to some variable in dialog flow and then ask next set of question?
I guess you're missing few steps here. Before, I explain you what to do, be sure to know what a postback is! Postback, when tapped, the text is sent as a user query to dialogflow.com.
Step-1: I created an intent with custom payload as follows:
Step-2: Now, I created a new intent where I have entered user says as noeggs which is of type postback & payload as noeggs the in previous image.
Step-3: Save & test it in FB Messenger.
So basically, what has happened here is, when you click on Eggless button, postback as noeggs is sent as user query to dialogflow.com where there is an intent which matches user says with noeggs & sends response back.
Related
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"
}
}
If our backend receive a request for say AMAZON.YesIntent or any other custom intent. Can we Elicit slot of a different intent than the triggered intent as response.
Ex:
...
user: Yes
(Amazon.YesIntent is mapped)
Alexa: Which city do you want to stay in?
(elicit slot of another intent)
...
Yes this is now possible, read the update section
Unfortunately you can't. Only updated intent of same type can be sent with a Dialog.ElicitSlot directive.
Note that you cannot change intents when returning a Dialog directive,
so the intent name and set of slots must match the intent sent to your
skill.
You will receive an "Invalid Directive" card and "There was some problem with the requested skills response" as error message.
Update (April, 8th 2019)
Use updateIntent object to specify the new intent whose slot has to be triggered. When you update the Intent object originally sent to your skill with the new updateIntent, include all of the slots, including any empty slots you are not changing.
{
"type": "Dialog.ElicitSlot",
"slotToElicit": "slotOfSomeOtherIntent",
"updatedIntent": {
"name": "SomeOtherIntent",
"confirmationStatus": "NONE",
"slots": {
"slotOfSomeOtherIntent": {
"name": "slotOfSomeOtherIntent",
"value": "string",
"resolutions": {},
"confirmationStatus": "NONE"
}
}
}
}
Read more about Change the intent or update slot values during the dialog
Read more about ElicitSlot Directive
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
I am trying for push notification with multiple lines text message. I have tried many changes like FCMService.java with setBigStyle text format, HTML.fromHTML, and some other. But not able to get the multiple line message.
I have gone through multiple sites and solution but not work. Marking it at duplicate or vote down, help me. I will up flag for your answer.
Sorry Guys!. I have found the solution.
No need of doing any kind of modification in the any file like FCMService.java or any other custom messages for showing of multiple lines of Notification while using Push Notification V5.
Remove the field "style", from the object you are sending notification.
Automatically the Multiple lines of notification will be seen.
For more information, upvote the answer, ask your query. I will help you out.
Below is my notification payload. Here I don't have any style at
{
"registration_ids" : ["XXXXXX"],
"priority" : "high",
"content-available": "0",
"notification": {
"title": "New Message",
"body": "You have an Instruction received. Please contact your admin to process further and more queries“,
"badge": "2",
"sound" : "default"
},
"data" : {
"message": "New Message",
"body": "You have an Instruction received RM",
"sound" : "default",
"actionId": "123456",
"badgeCount": "1",
"instructionType": "History",
"targetFunction": "actions",
"notificationType": "pvm"
}
}
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
}
}
}