Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emoji in SimpleResponse

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 ?

like image 680
Sukh Avatar asked Oct 26 '25 13:10

Sukh


2 Answers

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

like image 197
Sukh Avatar answered Oct 28 '25 08:10

Sukh


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": {}
            }
        }
    }.....
like image 22
matthewayne Avatar answered Oct 28 '25 06:10

matthewayne