ticketmaster / actions-on-google-kotlin Goto Github PK
View Code? Open in Web Editor NEWUnofficial Actions on Google SDK for Kotlin and Java
License: Apache License 2.0
Unofficial Actions on Google SDK for Kotlin and Java
License: Apache License 2.0
Hi,
I've been struggling with this for a few days now.
askForUpdatePermission doesn't find my intent even though it is clearly there.
Can someone please help point in the right direction?
I followed the Update Sample at https://github.com/actions-on-google/dialogflow-updates-nodejs and got the update permission to work.
But when I added app.askForUpdatePermission("get.next.reminder") into my own code, the simulator says that my agent is not responding. I did not get the question to give update permission.
In the simulator error tab, I see an error:
MalformedResponse
expected_inputs[0].possible_intents[0].input_value_data: The intent the app is asking for permission to send updates for is not found..
So I checked the intent name (get.next.reminder) again in my agent and it is clearly there and mapped to an action. I also tested that this intent can be triggered by user input.
The response tab shows the response like this:
{
"conversationToken": "["actions_on_google"]",
"expectUserResponse": true,
"expectedInputs": [
{
"inputPrompt": {
"richInitialPrompt": {
"items": [
{
"simpleResponse": {
"textToSpeech": "PLACEHOLDER_FOR_PERMISSION"
}
}
]
}
},
"possibleIntents": [
{
"intent": "actions.intent.PERMISSION",
"inputValueData": {
"@type": "type.googleapis.com/google.actions.v2.PermissionValueSpec",
"permissions": [
"UPDATE"
],
"updatePermissionValueSpec": {
"intent": "get.next.reminder"
}
}
}
]
}
],
"responseMetadata": {
"status": {
"message": "Success (200)"
},
"queryMatchInfo": {
"queryMatched": true,
"intent": "d7edc1c1-1c67-49af-89bb-37e17ed35025"
}
}
}
Where I see PLACEHOLDER_FOR_PERMISSION in the response text.
Not sure why it is not finding the intent. Can anyone please please help with this?
Also, a separate but related question: once you give the permission, how can you remove it? This is really important to be able to test.
Thank you.
https://stackoverflow.com/questions/49661752/dialogflowapp-askforupdatepermission-not-working
This is my gradle import. I am unable to import the library in gradle. Getting a red line under com.ticketmaster.actions:common:2.0.2.
repositories {
mavenCentral()
jcenter()
}
dependencies {
compile 'com.tmsdurham.actions:actions-on-google:2.0.2'
}
Hello, I'm experiencing some problem with your library. I'm using your code to recognize the action after a request:
My intent action return "tell.popular" (this is the request that Dialogflow sends):
{
"responseId": "589e1fb4-56b6-4377-8944-16b442090958",
"queryResult": {
"queryText": "popolare",
**"action": "tell.popular",**
"parameters": {
"Filtro": "Popolarità"
},
"allRequiredParamsPresent": true,
"fulfillmentMessages": [
{
"text": {
"text": [
""
]
}
}
],
"intent": {
"name": "projects/nespressoadvisor/agent/intents/bb7a2662-2851-4d68-bb86-92d368b6d195",
"displayName": "choose_popular"
},
"intentDetectionConfidence": 1,
"diagnosticInfo": {},
"languageCode": "it"
},
"webhookStatus": {
"message": "Webhook execution successful"
}
}
and here is the code. Unfortunately it doesn't work and I can't find a way to check the whole flow from handleRequest(actionMap) and check how is managed the request.
Furthermore, if I try to evaluate the DialogflowAction(req, res).handleRequest(actionMap)
line during debug, it returns me "undefined". (???)
Could you help me?
const val POPULAR = "tell.popular"
@WebServlet(name = "Hello", value = "/")
class HomeController : HttpServlet() {
val actionMap = mapOf(POPULAR to ::popular)
fun popular(app: DialogflowApp) =
app.ask(app.buildRichResponse()
.addSimpleResponse(speech = "Hi there!", displayText = "Hello there!")
.addSimpleResponse(
speech = """I can show you basic cards, lists and carousels as well as suggestions on your phone""",
displayText = """I can show you basic cards, lists and carousels as well as suggestions""")
.addSuggestions("Basic Card", "List", "Carousel", "Suggestions"))
override fun doPost(req: HttpServletRequest, res: HttpServletResponse) {
DialogflowAction(req, res).handleRequest(actionMap)
}
Has this artifact been moved or renamed? README.md shows this POM dependency:
<dependency>
<groupId>com.tmsdurham.actions</groupId>
<artifactId>actions-on-google</artifactId>
<version>1.5.0</version>
<type>pom</type>
</dependency>
but mvnrepository.com can't find it.
Maven Central search returns only one result that doesn't match the README:
Group ID: ca.sukhsingh.actions (README says 'com.tmsdurham.actions')
Artifact ID: actions-on-google (matches README)
Latest Version: 1.0.2 (README says 1.5.0)
Is there a new group ID or artifact ID?
I use a BasicCard in my Java code but the Json serialisation is not correct.
I have "formattedText$sdk" = "" instead of "formattedText" = "".
May be "internal var" the cause ?
data class BasicCard(internal var title: String = "",
internal var formattedText: String = "",
internal var subtitle: String? = null,
internal var image: Image? = null,
internal var imageDisplayOptions: ImageDisplays? = null,
internal var buttons: MutableList = mutableListOf()) {
Hello, how can I trigger an event from my webhook server to Dialogflow? I need that to perform slot fulfillment via webhook.
This is the reference in Dialogflow docs:
https://dialogflow.com/docs/events#invoking_event_from_webhook
Here is a temporal solution using official Node.js library:
actions-on-google/actions-on-google-nodejs#64
But I don't know how to apply that using this library.
Here is a recent pull request to the official Node.js library adding this feature:
actions-on-google/actions-on-google-nodejs#105
Hi, it's a way to request for update permission to get push notifications work?
I am use OkHttp to make POST request with authentication to my server? but always happen this error, why? Other commands not using https work.
Any plans to support Dialogflow API v2?
Hello Patrick,
I'm trying to integrate Slack with Dialogflow, but I'm getting an error when the lib tries to parseFromJson.
Pretty much because the originalRequest.data.user is a String and not an user object.
The error is:
"java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 175 path $.originalRequest.data.user] with root cause"
When using google assistant it works perfectly because originalRequest.data.user is an user object.
Am I doing something wrong on this?
You can see the lack of a POM file here: https://jcenter.bintray.com/com/tmsdurham/actions/actions-on-google/2.0.2-alpha/
Just getting started on google actions v2. Wondering if you consider this library is stable enough to use?
https://bintray.com/patjackson52/maven/com.tmsdurham.actions/2.0.3-alpha
Using the following code:
@PostMapping("/")
fun intentMapper(req: HttpServletRequest, res: HttpServletResponse) {
DialogflowAction(req, res).handleRequest(mapOf("testAction" to ::test))
}
fun test(action: DialogflowApp) {
action.tell(speech="Text to speech", displayText="Text to display")
}
the response body fullfilment looks like this:
"fulfillment": {
"speech": "Text to speech",
"source": "",
"displayText": "", <-------------------------------- SHOULD NOT BE EMPTY
"messages": [
{
"type": 0,
"speech": "Text to speech"
}
],
"data": {
"google": {
"isSsml": false,
"noInputPrompts": [],
"expectUserResponse": false,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Text to speech",
"displayText": "Text to display"
}
}
],
"suggestions": []
}
}
}
}
We can access to the displayText of fulfillment.data.google.richResponse.items[0].simpleResponse.displayText
.
However, I was expecting the same text in displayText at fulfillment.displayText
like fulfillment.speech
, but it is empty.
I have been working on a google app engine project using the v2 branch. Looking for some guidence. I copied the DialogflowWebhook example and got a late init error that went away when I set Serializer.aogGson = Gson()
now I'm getting this exception
Uncaught exception from servlet
java.lang.Error: No response has been set. Is this being used in an async call that was not returned as a promise to the intent handler?
at actions.service.actionssdk.conversation.Conversation.response(Conversation.kt:391)
at actions.service.dialogflow.DialogflowConversation.commonPayload(Conv.kt:321)
at actions.service.dialogflow.DialogflowConversation.serialize(Conv.kt:366)
at actions.service.dialogflow.DialogflowSdk$handler$1.handle(Dialogflow.kt:450)
at actions.framework.StandardHandler$DefaultImpls.handle$default(Framework.kt:51)
at actions.expected.ServletHandler.handle(BuiltinFrameworks.kt:36)
at actions.service.dialogflow.DialogflowSdk$1.handle(Dialogflow.kt:463)
at actions.ServiceBaseApp.invoke(Assistant.kt:21)
at scott.servlets.FitnessAssistantServlet.simpleDialogFlowExample(FitnessAssistantServlet.kt:30)
at scott.servlets.FitnessAssistantServlet.doPost(FitnessAssistantServlet.kt:21)
My code
data class MyConversation(val temp: String? = null)
data class MyArgument(val temp: String? = null, var resultType: String? = null, var userDescision: String? = null)
class FitnessAssistantServlet: HttpServlet() {
val logger = Logger.getLogger("TestServlet")
@Throws(ServletException::class, IOException::class)
override fun doPost(req: HttpServletRequest, resp: HttpServletResponse) {
val dfApp = dialogflow<UserStorage<Any>, MyConversation, MyArgument>()
dfApp.frameworks.add(ServletFramework())
dfApp.intent("test") { conv -> conv.ask("Can you hear me?") }
dfApp(req, res
}
}
It feels like I'm missing some initialization logic somewhere, not sure where though.
Thoughts?
Hi,
hope find you well with this cold call.
I am an author of mocking framework for Kotlin
I see you are using mockito-kotlin.
I just want you to be aware that there is solution that fully supports Kotlin and ask to try it in your new/current projects.
I can help you if you answer to this issue.
Thanks and please star it
Hi Patrick, I know you will hate me for all these issues 😛 but I'm experiencing other problems with your sample.
In fact, if I say "list" or "basic card" it doesn't catch the appropriate intent. Furthermore, ANY response tested on Google Assistant simulator gives me error and tells me 'final_response' must be set.
The problems is obviously extended also on my projects: in fact none of the samples copied and paste on my code don't work on Google Assistant simulator.
I've tried to write down manually the same structure of JSON for the response and here is what i found:
Manually built response through Google Assistant tab on Dialogflow
{
"id":"a0e829f0-1dec-4624-9726-d76e2a6df19d",
"timestamp":"2018-05-01T14:33:23.67Z",
"lang":"it",
"result":{
"source":"agent",
"resolvedQuery":"popolare",
"action":"tell.popular",
"actionIncomplete":false,
"parameters":{
"Filtro":"Popolarità"
},
"contexts":[
{
"name":"_actions_on_google_",
"parameters":{
"Filtro":"Popolarità",
"Filtro.original":"popolare"
},
"lifespan":99
}
],
"metadata":{
"intentId":"bb7a2662-2851-4d68-bb86-92d368b6d195",
"webhookUsed":"false",
"webhookForSlotFillingUsed":"false",
"intentName":"choose_popular"
},
"fulfillment":{
"speech":"",
"messages":[
{
"type":"simple_response",
"platform":"google",
"textToSpeech":"Hello my friend"
},
{
"type":"suggestion_chips",
"platform":"google",
"suggestions":[
{
"title":"this"
},
{
"title":"or"
},
{
"title":"that"
}
]
},
{
"type":0,
"speech":""
}
]
},
"score":1
},
"status":{
"code":200,
"errorType":"success",
"webhookTimedOut":false
},
"sessionId":"adf3ea83-cc0e-410c-b642-28300d81549a"
}
and below you can see response coming from webhook:
{
"id":"513f3256-2e9c-4c94-93a4-1bfdb408a9b0",
"timestamp":"2018-05-01T14:34:18.722Z",
"lang":"it",
"result":{
"source":"agent",
"resolvedQuery":"popolare",
"action":"tell.popular",
"actionIncomplete":false,
"parameters":{
"Filtro":"Popolarità"
},
"contexts":[
{
"name":"_actions_on_google_",
"parameters":{
"Filtro":"Popolarità",
"Filtro.original":"popolare"
},
"lifespan":100
}
],
"metadata":{
"intentId":"bb7a2662-2851-4d68-bb86-92d368b6d195",
"webhookUsed":"true",
"webhookForSlotFillingUsed":"false",
"webhookResponseTime":297,
"intentName":"choose_popular"
},
"fulfillment":{
"speech":"Hi there from Java!",
"source":"",
"messages":[
{
"type":0,
"speech":"Hi there from Java!"
}
],
"data":{
"google":{
"isSsml":false,
"noInputPrompts":[
],
"expectUserResponse":true,
"richResponse":{
"items":[
{
"simpleResponse":{
"textToSpeech":"Hi there from Java!",
"displayText":"Hello there from Java!"
}
}
],
"suggestions":[
{
"title":"hello"
},
{
"title":"hi"
}
]
}
}
}
},
"score":1
},
"status":{
"code":200,
"errorType":"success",
"webhookTimedOut":false
},
"sessionId":"adf3ea83-cc0e-410c-b642-28300d81549a"
}
As you can see, in the fulfillment object is really different for the "messages" and "data" object: what's happening?
In the current v2 alpha intentDetectionConfidence
is declared as an Int which is incorrect as it is a floating point number
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.