actions-on-google-kotlin icon indicating copy to clipboard operation
actions-on-google-kotlin copied to clipboard

Error when parsing json coming from slack

Open marcelorcorrea opened this issue 7 years ago • 3 comments

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?

marcelorcorrea avatar Dec 08 '17 12:12 marcelorcorrea

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?

patjackson52 avatar Dec 27 '17 22:12 patjackson52

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!

marcelorcorrea avatar Jan 03 '18 15:01 marcelorcorrea

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.

patjackson52 avatar Feb 22 '18 13:02 patjackson52