When building bot’s for Microsoft Teams you have to keep in mind that Microsoft Teams acts differently when sending emojis. When testing out a bot I was building I always got an error when sending š. When testing out the bot in the emulator it always worked. Why is this?
You would think that Teams sends the same text value as the Bot Framework emulator or like we used to do 20 years ago and it would send :-) But Teams act’s differently. It sends an attachment with an image.
The reason for this I had to google myself:
An**Ā emoticon**Ā is a representation of a human facial expression using only keyboard characters such as letters, numbers and punctuation marks.Ā EmoticonsĀ became popular in the 1990s with the advent of emails and texting. The wordĀ emoticonĀ is a portmanteau, made by combining the wordsĀ emotionĀ andĀ icon. Remember, anĀ emoticonĀ is built from keyboard characters that when put together in a certain way represent a facial expression, anĀ emojiĀ is an actual image.
This is normal text send through Teams
"conversation": {
"conversationType": "personal",
"id": "a:1C234VF3xRJJjyvni80pqqwvot6zk3\_IdgVcq1loy5aEV17xGkHbLVDczZnyVXZcZELvayWYNMDXlyXbPGn5PJzrPFQhawZN7hPuaysG3FFrjWykULG8yRdfR0pyVhI70",
"tenantId": "39213499-7cc3-4cca-901c-31a0924d47e2"
},
"recipient": {
"id": "28:ffb802b5-3dde-41e3-887c-463c05c96776",
"name": "365-QA"
},
"textFormat": "plain",
"locale": "en-US",
**"text": "hi",**
"entities": \[
{
"type": "clientInfo",
"locale": "en-US",
"country": "US",
"platform": "Web"
}
\],
And this is when I send š
"recipient": {
"id": "28:ffb802b5-3dde-41e3-887c-463c05c96776",
"name": "365-QA"
},
"locale": "en-US",
"attachments": \[
{
"contentType": "image/\*",
**"contentUrl": "https://statics.teams.microsoft.com/evergreen-assets/skype/v2/smile/50.png"
},
{
"contentType": "text/html",
"content": "<div><div><span class=\\"animated-emoticon-50-smile\\" title=\\"Smiley\\" type=\\"(smile)\\"><img itemid=\\"smile\\" itemscope=\\"\\" itemtype=\\"http://schema.skype.com/Emoji\\" src=\\"https://statics.teams.microsoft.com/evergreen-assets/skype/v2/smile/50.png\\" alt=\\"š\\" style=\\"width:50px; height:50px\\"></span></div>\\n</div>"
}**
\],
"entities": \[
{
"type": "clientInfo",
"locale": "en-US",
"country": "US",
"platform": "Web"
}
\],
As you can see there is no text. So be aware when building your bot in Teams that even when you are expecting text (because you didn’t activate “My bot supports uploading and downloading files”) it can always be an attachment because people can react with emojis.