I've been trying to pass parameter using m.me link, but when tester/ developer account of my app tried this feature, my webhook didn't receive any event.
My bot already has a get started button and the page is published.
what im trying to ask is why couldn't i get any event and how to solve this problem?
let message = {
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [
{
"title": "Share me 😊",
"subtitle": "share to your friend",
"image_url": "https://gallery.yopriceville.com/var/resizes/Free-Clipart-Pictures/Sun-and-Moon-PNG/Transparent_Sun_with_Shades_PNG_Clipart_Picture.png?m=1434276589",
"buttons": [
{
"type": "element_share",
"share_contents": {
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [
{
"title": "Add to connect to your friend",
"subtitle": "connect",
"image_url": output.profile_pic,
"default_action": {
"type": "web_url",
"url": `http://m.me/${page_id}?ref=invited_by_${recipientId}`
},
"buttons": [
{
"type": "web_url",
"url": `http://m.me/${page_id}?ref=invited_by_${recipientId}`,
"title": `ADD ${output.first_name}`
}
]
}
]
}
}
}
}
]
}
]
}
}
};
Related
I am displaying some data in using adaptive card in BOT emulator,I want to add one comment section there.I tried this way:
{
"type": "Action.ShowCard",
"title": "Comment",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "Input.Text",
"id": "test",
"isMultiline": true,
"placeholder": "Enter your comment",
}
],
"actions": [
{
"type": "Action.Submit",
"id":"submit",
"title": "OK",
"data":
{
"test":""
}
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}
}
]
but not getting any output when click on OK action.How can we do it?
Im trying to build a webhook for dialogflow with help from nuget package Google.Cloud.Dialogflow.V2.
Im running the code with .Net Core 2.1.
I get the fullfilmentText to show in dialogflow, but cant make the carousel to show up.
What am I doing wrong?
Here is my method:
[HttpPost]
public ContentResult Post([FromBody] WebhookRequest webhookRequest)
{
var dialogflowResponse = new WebhookResponse { FulfillmentText = "FulfillmentText" };
var carousel = new Intent.Types.Message.Types.CarouselSelect.Types.Item
{
Title = "My title",
Description = "This is a description",
Image = new Intent.Types.Message.Types.Image
{
ImageUri = "https://placekitten.com/200/300",
AccessibilityText = "cat"
},
Info = new Intent.Types.Message.Types.SelectItemInfo
{
Key = "Cats"
}
};
carousel.Info.Synonyms.Add("Synonym 1");
carousel.Info.Synonyms.Add("Synonym 1");
dialogflowResponse.FulfillmentMessages.Add(new Intent.Types.Message {
CarouselSelect = new Intent.Types.Message.Types.CarouselSelect()
});
dialogflowResponse.FulfillmentMessages.First().CarouselSelect.Items.Add(carousel);
return dialogflowResponse;
}
Generates followiing Json:
{
"fulfillmentText": "FulfillmentText",
"fulfillmentMessages": [
{
"carouselSelect": {
"items": [
{
"info": {
"key": "Cats",
"synonyms": [
"Synonym 1",
"Synonym 1"
]
},
"title": "My title",
"description": "This is a description",
"image": {
"imageUri": "https://placekitten.com/200/300",
"accessibilityText": "cat"
}
}
]
}
}
]
}
i ran into the same problem with the java api. Only the basic rich messages (card, quick replies, ...) are working. BasicCard, Suggestions, Carousel, ... doesn't show up in any channel.
I got it to work if i added some of the following custom payload to skype channel:
{
"skype": {
"type": "message",
"attachmentLayout": "carousel",
"text": "Please select your food.",
"attachments": [{
"contentType": "application/vnd.microsoft.card.hero",
"content": {
"title": "Sushi",
"subtitle": "Very fresh shrimp or tuna.",
"images": [{
"url": "https://i.ibb.co/87LmvT3/mdi.png"
}
],
"buttons": [{
"type": "imBack",
"title": "1 piece",
"value": "sushi,1"
}, {
"type": "imBack",
"title": "2 piece",
"value": "sushi,2"
}, {
"type": "imBack",
"title": "more",
"value": "sushi,3+"
}
]
}
}, {
"contentType": "application/vnd.microsoft.card.hero",
"content": {
"title": "Tenpura",
"subtitle": "Japanese first-class vegitables.",
"images": [{
"url": "https://i.ibb.co/87LmvT3/mdi.png"
}
],
"buttons": [{
"type": "imBack",
"title": "1 piece",
"value": "tenpura,1"
}, {
"type": "imBack",
"title": "2 piece",
"value": "tenpura,2"
}, {
"type": "imBack",
"title": "more",
"value": "tenpura,3+"
}
]
}
}
]
}}
I hope it helps!
I've a webhook for fulfillment.
Below is the code that's responding back
let result_obj = {
"fulfillmentText": "This is a text response",
"fulfillmentMessages": [
{
"text": {
"text": [
"this is test"
]
}
},
{
"card": {
"title": "card title",
"subtitle": "card text",
"imageUri": "https://assistant.google.com/static/images/molecule/Molecule-Formation-stop.png",
"buttons": [
{
"text": "button text",
"postback": "https://assistant.google.com/"
}
]
}
}
]
}
Below is the result from dialogflow GUI
Below is what I get when I run from the simulator or from the Google Assistant application on the Android phone
Both the simulator and phone are not showing the cards. Am I missing something obvious here?
For rich responses like cards to show on Google Assistant you have to use the payload part of response JSON, here is an example:
{
"fulfillmentText": "This is a text response",
"fulfillmentMessages": [],
"source": "example.com",
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "This is a Basic Card:"
}
},
{
"basicCard": {
"title": "card title",
"image": {
"url": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png",
"accessibilityText": "Google Logo"
},
"buttons": [
{
"title": "Button Title",
"openUrlAction": {
"url": "https://www.google.com"
}
}
],
"imageDisplayOptions": "WHITE"
}
}
]
}
}
},
"outputContexts": [],
"followupEventInput": {}
}
Check out this github repo for all rich-responses' JSON formats.
How do to identify from which platform the message came?
I want to support different platforms like Telegram and Facebook Messenger, When my webhook receive a message, I want to reply according to the platform the message came form.
For example, if the message came from Telegram I want to return a text message but if the message came from messenger I want to return a card.
You have a property source in originalRequest object, see fulfillment docs here.
{
"lang": "en",
"status": {
"errorType": "success",
"code": 200
},
"timestamp": "2017-02-09T16:06:01.908Z",
"sessionId": "1486656220806",
"result": {
"parameters": {
"city": "Rome",
"name": "Ana"
},
"contexts": [],
"resolvedQuery": "my name is Ana and I live in Rome",
"source": "agent",
"score": 1.0,
"speech": "",
"fulfillment": {
"messages": [
{
"speech": "Hi Ana! Nice to meet you!",
"type": 0
}
],
"speech": "Hi Ana! Nice to meet you!"
},
"actionIncomplete": false,
"action": "greetings",
"metadata": {
"intentId": "9f41ef7c-82fa-42a7-9a30-49a93e2c14d0",
"webhookForSlotFillingUsed": "false",
"intentName": "greetings",
"webhookUsed": "true"
}
},
"id": "ab30d214-f4bb-4cdd-ae36-31caac7a6693",
"originalRequest": {
"source": "google",
"data": {
"inputs": [
{
"raw_inputs": [
{
"query": "my name is Ana and I live in Rome",
"input_type": 2
}
],
"intent": "assistant.intent.action.TEXT",
"arguments": [
{
"text_value": "my name is Ana and I live in Rome",
"raw_text": "my name is Ana and I live in Rome",
"name": "text"
}
]
}
],
"user": {
"user_id": "PuQndWs1OMjUYwVJMYqwJv0/KT8satJHAUQGiGPDQ7A="
},
"conversation": {
"conversation_id": "1486656220806",
"type": 2,
"conversation_token": "[]"
}
}
} }
In an app, I'm returning messages of type list_card with option key for an intent.
Here is the json of a sample query:
{
"id": "275212ef-cf97-4576-afa7-facfbc044ada",
"timestamp": "2017-07-17T17:36:03.655Z",
"lang": "en",
"result": {
"source": "agent",
"resolvedQuery": "who is Sneha",
"action": "cp.name_search",
"actionIncomplete": false,
"parameters": {
"keyword": "Sneha"
},
"contexts": [
{
"name": "cpname_search-followup",
"parameters": {
"keyword.original": "Sneha",
"keyword": "Sneha"
},
"lifespan": 2
},
{
"name": "cpuid_search-followup",
"parameters": {
"keyword.original": "Sneha",
"keyword": "Sneha"
},
"lifespan": 1
}
],
"metadata": {
"intentId": "86bd1a17-8e9a-4956-b270-5fb4ac952f5f",
"webhookUsed": "true",
"webhookForSlotFillingUsed": "false",
"webhookResponseTime": 135,
"intentName": "cp.name_search"
},
"fulfillment": {
"speech": "Searching...",
"source": "agent",
"messages": [
{
"type": "simple_response",
"platform": "google",
"textToSpeech": "Here are the search results. \nWant anything else?"
},
{
"type": "list_card",
"platform": "google",
"title": "Search results",
"items": [
{
"optionInfo": {
"key": "uid 72",
"synonyms": []
},
"title": "Sneha Vasista",
"description": "Srinivas Institute of Technology",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
},
{
"optionInfo": {
"key": "uid 2053",
"synonyms": []
},
"title": "Sneha Bhat",
"description": "Canara Engineering College",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
},
{
"optionInfo": {
"key": "uid 2114",
"synonyms": []
},
"title": "Sneha Sajan",
"description": "P.A College of Engineering",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
},
{
"optionInfo": {
"key": "uid 2320",
"synonyms": []
},
"title": "Sneha ",
"description": "sdit",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
},
{
"optionInfo": {
"key": "uid 2363",
"synonyms": []
},
"title": "Sneha ",
"description": "Srinivas School of Engineering, Mukka",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
}
]
},
{
"type": "0",
"speech": "Here are the search results."
}
]
},
"score": 1
},
"status": {
"code": 200,
"errorType": "success"
},
"sessionId": "e6aa9e52-a9e1-481a-adb5-476c5b386e02"
}
Now the problem is, when I tap the list item in AoG simulator, it passes title of item to next query.
But while testing in Api.ai simulator, it behaves well and passes that key to the next query.
What can be the problem here?
Any hints?
If you're using API.AI, then it will appear in the Intent as an actions_intent_OPTION Event.
One good solution is to have the Intent that sends the list with an OutputContext. Then create a particular Fallback Intent with actions_intent_OPTION as Event and your desired action for that Context which should handle both the voice and press responses.
And you will find your option_key at ["originalRequest"]["data"]["inputs"][0]["arguments"][0]["textValue"] instead of parameter.
You can also see the response value in the actions_intent_option context.
What you need to do is set up a fallback intent directly under your current intent.
For example, if you display the list from the default welcome intent, you can do the following.
Click "Add follow-up intent" and choose fallback.
Don't forget to set the action and enable webhook in the fallback intent.
Now, you should be able to retrieve your answer from the fallback intent using the following code.
const param = app.getContextArgument('actions_intent_option','OPTION').value;