You send the string "{rt8}" and the client on the receiving end converts it into the appropriate texture. In Classic, this is done by
ChatFrame_ReplaceIconAndGroupExpressions(). In Modern, this was moved into C code and is handled by
C_ChatInfo.ReplaceIconAndGroupExpressions().
Here's a list of these icon tags.
https://wow.gamepedia.com/Chat_substitutions