ticketmaster / actions-on-google-kotlin

Unofficial Actions on Google SDK for Kotlin and Java
Apache License 2.0
119 stars 20 forks source link

Error when parsing json coming from slack #34

Open marcelorcorrea opened 6 years ago

marcelorcorrea commented 6 years ago

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?

patjackson52 commented 6 years ago

Thanks for reporting. I have yet to use slack integration with the lib, apparently the json for the user field is either a empty string, or possibly just an Id. Either way, this will likely take a custom TypeAdapter for the Request. Can you post the json that Dialogflow sends to you?

marcelorcorrea commented 6 years ago

Hello Patrick, surething. Here's the json: "originalRequest":{"source":"slack_testbot","data":{"event_ts":"1514991529.000290","channel":"D8A39C5U1","text":"what\u0027s the weather for today","type":"message","user":"U8AKP8J5A","ts":"1514991529.000290"}} the user is a String not an object, that's why it's breaking. Thanks!

patjackson52 commented 6 years ago

Thanks for the info. I would like to get to this, but not a priority at the moment, so not sure when it will happen. PRs are welcome.