🚧

Note

For early access clients only

Our business messaging API supports sending and receiving Telegram messages.

Fact sheet

FeatureSupportRemarks
encryptionyesAll Telegram messages are always encrypted. Messages in Secret Chats use client-client encryption, while Cloud Chats use client-server/server-client encryption and are stored encrypted in the Telegram Cloud.
delivery notificationnoTelegram does not support status reports. They state it in their FAQ "We don‘t have a ’delivered to device' status for messages because Telegram can run on as many devices as you want."
text messagesyesThe maximum length of a Telegram message is 4096 characters and it must be UTF-8 encoded.
urls in textyes
mediayesMedia name attribute should end in the proper file extension. You can send more media files in one message. When sending multiple files, each file will be sent in its own Telegram message.
media: imagesyesMaximum file size for an uploaded image with an publicly available url is 5 MB. Supported MIME types are image/jpeg, image/png, image/webp.
media: gifsyesMaximum file size for an uploaded animation with an publicly available url is 20 MB. Supported MIME types are image/gif, video/mpeg without sound.
media: videoyesMaximum file size for an uploaded video with an publicly available url is 20 MB. Supported MIME types are video/mp4, other mime types will be send as a document.
media: audioyesMaximum file size for an uploaded audio file with an publicly available url is 20 MB. Supported MIME types are audio/mpeg.
media: documentyesMaximum file size for an uploaded document with an publicly available url is 20 MB.
media: stickeryesMaximum file size for an uploaded sticker with an publicly available url is 20 MB. Supported MIME types are image/webp, and Telegram's own stickers .TGS files.
reply suggestionscoming soon

Onboarding

Onboarding pages for telegram are in development, in the meantime you are welcome to onboard your app via your customer success manager.

Business rules

Sending Telegram messages using the CM Business Messaging API also requires you to adhere to the Telegram policy.

It is allowed to have multiple bots under one CM.com account.

Considerations

The only way to have a Telegram conversation with end-users is when the end-user starts the conversation by sending your bot an initial message.

If you stop using Telegram and don't come online for at least six months, your account will be deleted along with all messages, media, contacts and every other piece of data you store in the Telegram cloud. You can change the exact period after which your inactive account will self-destruct in Settings.

Prerequisites

To be able to onboard, you need to set-up the following:

Sending messages

Unlike other channels, Telegram does not use telephone numbers as identifiers for sender (from) and recipient (to.number), instead it uses a so called "Chat ID" for the recipient and an "Bot ID" for the sender. A person is assigned a unique Chat ID for each bot they start a conversation with.

Display order

If you send a message including both Media and some text, Telegram will display this as one entity, always placing the text below the Media, and “joining” the two visually.

Receiving messages / Inbound flow

Since Telegram is used for 2-way communication (chat) it is important to also implement an Inbound flow. You can find more information about how to do this using our API documentation of the Inbound webhook. Note that for Telegram you need to set up your webhook API in the Channels app, not in the Gateway app.

Examples

Direct message with plain text contents

The example below will send a simple text-only Telegram message.

{
    "messages": {
        "authentication": {
            "producttoken": "Your product token"
        },
        "msg": [
            {
                "from": "Your bot ID",
                "to": [
                    {
                        "number": "Recipients Identifier"
                    }
                ],
                "body": {
                    "content": ""
                },
                "allowedChannels": ["Telegram Messenger"],
                "body": {
                    "type": "auto",
                    "content": "CM.com - Be part of it."
                }
            }
        ]
    }
}

Direct message with text and image

In the example below we send a simple rich content message that contains both text and Media that Telegram will display as one entity. An explanation on how to send rich content messages in general can be found in the rich content description.

{
    "messages": {
        "authentication": {
            "producttoken": "Your product token"
        },
        "msg": [
            {
                "from": "Your bot ID",
                "to": [
                    {
                        "number": "Recipients Identifier"
                    }
                ],
                "body": {
                    "content": ""
                },
                "allowedChannels": ["Telegram Messenger"],
                "richContent": {
                    "conversation": [
                        {
                            "text": "CM.com - Be part of it.",
                            "media": {
                                "mediaName": "conversational-commerce.jpg",
                                "mediaUri": "https://www.cm.com/cdn/web/nl-nl/blog/conversational-commerce.jpg",
                                "mimeType": "image/jpeg"
                            }
                        }
                    ]
                }
            }
        ]
    }
}

Did this page help you?