Emoji in SimpleResponse

3k views Asked by At

https://stackoverflow.com/a/45890852/8413869

from the above answer, I got to know that emojis can be passed in Button formatted text.

But I am looking for emojis like google have it in Bubble response. enter image description here

I tried to pass unicode in simple response but no luck.

....."data": {
        "google": {
            "expectUserResponse": true,
            "richResponse": {
                "items": [
                    {
                        "simpleResponse": {
                            "ssml": "<speak>Hello. How are you ? </speak>",
                            "displayText": "Hello U+1F600., how are you ? "
                        }
                    }
                ],
                "suggestions": [],
                "linkOutSuggestion": {}
            }
        }
    }.....

Is there any way to do this ?

2

There are 2 answers

0
Sukh On BEST ANSWER

I made it work with this uni code " \uD83D\uDE00" I just copied emoji from https://emojipedia.org/ which gave me this unicode

3
mattcarrollcode On

You can include emoji in simple responses for Google Assistant apps by including the actual emoji in the string instead of the Unicode code point for the emoji. Change your response to the below and it should work:

....."data": {
        "google": {
            "expectUserResponse": true,
            "richResponse": {
                "items": [
                    {
                        "simpleResponse": {
                            "ssml": "<speak>Hello. How are you ? </speak>",
                            "displayText": "Hello ., how are you ? "
                        }
                    }
                ],
                "suggestions": [],
                "linkOutSuggestion": {}
            }
        }
    }.....