Producer Example

The following is a basic example of how to send a message to a Telegram chat through the Telegram Bot API.

in Java DSL


or in Spring XML

    <from uri="direct:start"/>
    <to uri="telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L"/>

The code 123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L is the authorization token corresponding to the Bot.

When using the producer endpoint without specifying the chat id option, the target chat will be identified using information contained in the body or headers of the message. The following message bodies are allowed for a producer endpoint (messages of type OutgoingXXXMessage belong to the package org.apache.camel.component.telegram.model)

Java TypeDescription


To send a text message to a chat


To send a photo (JPG, PNG) to a chat


To send a mp3 audio to a chat


To send a mp4 video to a chat


To send any media type supported. It requires the CamelTelegramMediaType header to be set to the appropriate media type


To send a text message to a chat. It gets converted automatically into a OutgoingTextMessage