How to send emoji or other symbol via the API??#
There are several ways to send emojis or other symbols via API:
1. Using hotkeys#
The simplest way to do this is to use the built-in emoji feature of your operating system.
Unfortunately, this method does not work everywhere.
To do this, place the cursor in the text field and use the hotkeys:
- For Windows:
Win + .
- For MacOS:
control + command + space
Then select the symbol of interest in the pop-up window.
2. Copying and pasting#
If the 'Hotkey' method does not work in your application, and the hotkeys are not functioning, sometimes the simplest solution is to copy emojis from a messenger, browser, or any other source.
Example: 😃😎🤯
Example of a site with emoji.
3. Using character codes#
If the field does not support emoji insertion or if the inserted emojis do not display correctly, consider using a character encoding.
This method does not function directly in WhatsApp, WhatsApp Web, browsers, or Console.
It is only applicable for sending raw text via the API (such as Postman, 1C processing, or within the body of an HTTP request).
To send emoticons to WhatsApp from our API, we recommend using UTF-16. To do this, you need to represent the character as a hexadecimal number or a surrogate pair, two hexadecimal numbers.
\uD83D\uDE01
- an example of a surrogate pair
These numbers are in the Unicode character table.
Sending characters as surrogate pairs#
Steps to provide the character as hexadecimal numbers:
-
Click on the Unicode column value next to the selected emoji.
-
Then select the column with surrogate pairs, for example for the emoji 😁.
-
Specify the text in Unicode encoding by entering a backslash with the lowercase Latin letter u (
"\u"
) before each hexadecimal number.
For example:D83D DE01
=>\uD83D\uDE01
Example of sending 😁 through 1C processing
By sending this string from the API via 1C processing, you will send - 😁 on WhatsApp:
Insert a surrogate pair for the desired emoticon, in this case: \uD83D\uDE01
Result in WhatsApp:
Sending characters without surrogate pairs#
For some emojis and symbols, there is no surrogate pair. Steps to provide the character as a hexadecimal number:
-
Click on the Unicode column value next to the chosen emoji.
-
Then select the Code column, for example, for the emoji ✅.
-
Specify the text in Unicode encoding by entering a backslash with the lowercase Latin letter u (
"\u"
) before the hexadecimal number.
Например:2705
=>\u2705
Example of sending ✅ via Postman
By sending this string from the API via Postman, you will send - ✅ on WhatsApp:
Insert the hexadecimal number for the desired emoji, in this case: \u2705
Result in WhatsApp:
Using character spacing
Using a 16-bit character representation allows the use of invisible characters that indicate the spacing between letters or numbers. This makes it possible, for example, to send empty messages or more finely adjust the indentation.
Examples of interval symbols:
\u00A0 - Non-Breaking Space | |
\u2000 - En Quad | |
\u2001 - Em Quad | |
\u2002 - En Space | |
\u2004 - Three-Per-Em Space | |
\u2005 - Four-Per-Em Space | |
\u2006 - Six-Per-Em Space | |
\u2007 - Figure Space | |
\u2008 - Punctuation Space | |
\u2009 - Thin Space | |
\u200A - Hair Space | |
\u2028 - Line Separator | |
\u205F - Medium Mathematical Space | |
\u3000 - Ideographic Space |