Key differences of the Telegram version#
The Telegram version is developed on the basis of the current version of GREEN-API. The architecture and logic of interaction with the API remain the same, however there are a number of differences due to how the Telegram messenger works. The main differences of the Telegram version are presented below.
Contents#
- Chat identifier
- Messenger type in a webhook
- Unlimited number of Telegram clients
- Partner methods
- Message with a sticker
- Others
Chat identifier#
The chat identifier no longer contains the @c.us and @g.us prefixes.
The @c.us prefix is kept only for sending messages by phone number to maintain backward compatibility.
ChatId can be either a positive number (for individual chats) or a negative one (for group chats).
- Example of a personal chat identifier:
1234567890 - Example of a group chat identifier:
-12345678909876
The identifier is represented as a string, however, for more compact storage in a database, it is recommended to convert it from a string to a number.
Messenger type in a webhook#
To determine the type of messenger a webhook came from, you can analyze the webhook property instanceData.typeInstance.
- For the Telegram messenger:
"typeInstance": "telegram" - For the WhatsApp messenger:
"typeInstance": "whatsapp" - For the MAX messenger:
"typeInstance": "v3"
Unlimited number of Telegram clients#
The Telegram messenger supports connecting an unlimited number of web clients and mobile applications to a single phone number.
Thanks to this, you can create several instances and connect several Telegram clients to GREEN-API - one to each instance.
For example, one client can serve the managers' chats, and a second client can serve the chatbot on the website, all from a single phone number.
Partner methods#
The partner methods have not changed and do not require any rework.
A full description of all partner methods can be found in the Partner methods section.
Message with a sticker#
The sticker object for a message with the stickerMessage type is contained in the stickerMessageData structure.
The fileMessageData structure is not used for messages with stickers in Telegram.
Others#
Some methods may return a set of parameters specific to the Telegram messenger.
A full description of all methods and parameters can be found in the Telegram messenger API documentation