Verify Snips IntentMessage for Android

I have an application that uses the Snips Android SDK and I have been post processing the IntentMessage, converting it to JSON and then publishing it over MQTT to my Home Assistant Snips instance.

Looking at the code, I noticed I was also swapping out one of the parameters of the IntentMessage object, I was converting the parameter name from “type” to “kind” before sending the MQTT message.

I do recall adding that, but I couldn’t remember why I was changing the parameter name. For example, normally the IntentMessage object converted to JSON would look like this:

{"customData":null,"input":"turn off the kitchen light","intent":{"confidenceScore":0.88660264,"intentName":"hass:HassTurnOff"},"sessionId":"3e8b23f3-3873-4451-a36f-ffcbf33a0fbd","siteId":"voicepanel","slots":[{"confidenceScore":0.9904163,"entity":"hass_entity","range":{"end":26,"start":13},"rawValue":"kitchen light","slotName":"name","value":{"value":"kitchen light","type":"CUSTOM"}}]}

You see the last parameter for the value is "type":"CUSTOM". I have been changing that to "kind":"CUSTOM". So, my question is, do I still need to do this and if so why?

Hi @thanksmister up until a few version back (I don’t remember which one exactly) transforming the SDK objects to json didn’t yield the canonical json representation. We’ve now fixed that. What you’re describing is exacty the sort of things we changed. You should use Jackson to convert the SDK objects to json (it also works to create such objects from json if needed), as the classes are properly annotated to work with it.

@fredszaq I am using Gson to convert the IntentMessage and I have the latest SDK. I am still seeing the issue with the latest Snips Android SDK. If it’s not fixed, should I still be converting type to kind? I can try with Jackson, but Gson should yield the same results.