You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2016/05/21 08:41:06 UTC

[3/5] camel git commit: CAMEL-9969: Added a component for Telegram

CAMEL-9969: Added a component for Telegram


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8dc984eb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8dc984eb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8dc984eb

Branch: refs/heads/master
Commit: 8dc984ebdb99810028e1731568e8a55eaeb5b641
Parents: 7029076
Author: Nicola Ferraro <ni...@gmail.com>
Authored: Fri May 20 12:26:30 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Sat May 21 10:36:04 2016 +0200

----------------------------------------------------------------------
 .../src/main/descriptors/common-bin.xml         |   1 +
 components/camel-telegram/pom.xml               | 135 ++++++++++
 .../camel-telegram/src/main/docs/telegram.adoc  | 256 +++++++++++++++++++
 .../component/telegram/TelegramComponent.java   |  46 ++++
 .../telegram/TelegramConfiguration.java         | 136 ++++++++++
 .../component/telegram/TelegramConstants.java   |  34 +++
 .../component/telegram/TelegramConsumer.java    | 109 ++++++++
 .../component/telegram/TelegramEndpoint.java    |  66 +++++
 .../component/telegram/TelegramMediaType.java   |  36 +++
 .../component/telegram/TelegramProducer.java    |  90 +++++++
 .../component/telegram/TelegramService.java     |  32 +++
 .../telegram/TelegramServiceProvider.java       |  91 +++++++
 .../camel/component/telegram/model/Chat.java    |  73 ++++++
 .../component/telegram/model/IncomingAudio.java | 109 ++++++++
 .../telegram/model/IncomingMessage.java         | 135 ++++++++++
 .../telegram/model/IncomingPhotoSize.java       |  87 +++++++
 .../component/telegram/model/IncomingVideo.java | 122 +++++++++
 .../telegram/model/OutgoingAudioMessage.java    |  97 +++++++
 .../telegram/model/OutgoingMessage.java         |  74 ++++++
 .../telegram/model/OutgoingPhotoMessage.java    |  72 ++++++
 .../telegram/model/OutgoingTextMessage.java     |  74 ++++++
 .../telegram/model/OutgoingVideoMessage.java    | 108 ++++++++
 .../model/UnixTimestampDeserializer.java        |  48 ++++
 .../camel/component/telegram/model/Update.java  |  64 +++++
 .../component/telegram/model/UpdateResult.java  |  65 +++++
 .../camel/component/telegram/model/User.java    |  87 +++++++
 .../component/telegram/service/RestBotAPI.java  |  83 ++++++
 .../TelegramServiceRestBotAPIAdapter.java       | 162 ++++++++++++
 .../telegram/util/TelegramConverter.java        | 158 ++++++++++++
 .../services/org/apache/camel/TypeConverter     |  18 ++
 .../org/apache/camel/component/telegram         |  17 ++
 .../component/telegram/TelegramChatBotTest.java | 116 +++++++++
 .../telegram/TelegramConfigurationTest.java     |  58 +++++
 .../TelegramConsumerEmptyResponseTest.java      |  66 +++++
 .../telegram/TelegramConsumerMappingTest.java   | 106 ++++++++
 .../TelegramConsumerMediaPhotoTest.java         |  78 ++++++
 .../TelegramConsumerMediaVideoTest.java         |  89 +++++++
 .../telegram/TelegramConsumerMultipleTest.java  |  75 ++++++
 .../TelegramConsumerServiceErrorTest.java       |  78 ++++++
 .../telegram/TelegramConsumerSingleTest.java    |  73 ++++++
 .../TelegramProducerChatIdResolutionTest.java   |  85 ++++++
 .../telegram/TelegramProducerMediaTest.java     | 141 ++++++++++
 .../integration/TelegramServiceTest.java        | 180 +++++++++++++
 .../telegram/util/TelegramTestSupport.java      |  91 +++++++
 .../telegram/util/TelegramTestUtil.java         |  61 +++++
 .../src/test/resources/attachments/sample.jpg   | Bin 0 -> 19314 bytes
 .../src/test/resources/attachments/sample.mp3   | Bin 0 -> 30439 bytes
 .../src/test/resources/attachments/sample.mp4   | Bin 0 -> 299284 bytes
 .../src/test/resources/attachments/sample.png   | Bin 0 -> 28947 bytes
 .../src/test/resources/log4j.properties         |  32 +++
 .../test/resources/messages/updates-empty.json  |   4 +
 .../resources/messages/updates-media-video.json |  36 +++
 .../test/resources/messages/updates-media.json  |  67 +++++
 .../resources/messages/updates-multiple.json    |  41 +++
 .../test/resources/messages/updates-single.json |  23 ++
 components/pom.xml                              |   1 +
 parent/pom.xml                                  |   5 +
 .../features/src/main/resources/features.xml    |  11 +
 .../camel/itest/karaf/CamelTelegramTest.java    |  34 +++
 59 files changed, 4236 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/apache-camel/src/main/descriptors/common-bin.xml
----------------------------------------------------------------------
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index ae84bf4..3587254 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -226,6 +226,7 @@
         <include>org.apache.camel:camel-swagger</include>
         <include>org.apache.camel:camel-swagger-java</include> 
         <include>org.apache.camel:camel-tagsoup</include>
+        <include>org.apache.camel:camel-telegram</include>
         <include>org.apache.camel:camel-test</include>
         <include>org.apache.camel:camel-test-blueprint</include>
         <include>org.apache.camel:camel-test-cdi</include>

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-telegram/pom.xml b/components/camel-telegram/pom.xml
new file mode 100644
index 0000000..382a7cc
--- /dev/null
+++ b/components/camel-telegram/pom.xml
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components</artifactId>
+    <version>2.18-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-telegram</artifactId>
+  <packaging>jar</packaging>
+  <name>Camel :: Telegram</name>
+  <description>Camel Telegram support</description>
+
+  <properties>
+    <camel.osgi.export.pkg>
+      org.apache.camel.component.telegram.*,org.apache.camel.component.telegram.model.*
+    </camel.osgi.export.pkg>
+    <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=telegram
+    </camel.osgi.export.service>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-rs-client</artifactId>
+      <version>${cxf-version}</version>
+    </dependency>
+
+
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>${jackson2-version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+      <version>${jackson2-version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>com.fasterxml.jackson.jaxrs</groupId>
+      <artifactId>jackson-jaxrs-json-provider</artifactId>
+      <version>${jackson2-version}</version>
+    </dependency>
+
+    <!-- test dependencies -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <version>${mockito-version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>**/org/apache/camel/component/telegram/*.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>telegram-integration-tests</id>
+      <activation>
+        <property>
+          <name>env.TELEGRAM_AUTHORIZATION_TOKEN</name>
+        </property>
+        <!-- Also env.TELEGRAM_CHAT_ID is needed by the tests -->
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <includes>
+                <include>**/org/apache/camel/component/telegram/**/*.java</include>
+              </includes>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/docs/telegram.adoc
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/docs/telegram.adoc b/components/camel-telegram/src/main/docs/telegram.adoc
new file mode 100644
index 0000000..5b33652
--- /dev/null
+++ b/components/camel-telegram/src/main/docs/telegram.adoc
@@ -0,0 +1,256 @@
+[[Telegram-TelegramComponent]]
+Telegram Component
+~~~~~~~~~~~~~~~~~~
+
+*Available as of Camel 2.18*
+
+The *Telegram* component provides access to the https://core.telegram.org/bots/api[Telegram Bot API].
+It allows a Camel-based application to send and receive messages by acting as a Bot, participating in
+direct conversations with normal users, private and public groups or channels.
+
+A Telegram Bot must be created before using this component, following the instructions at the
+link:https://core.telegram.org/bots#3-how-do-i-create-a-bot[Telegram Bot developers home].
+When a new Bot is created, the link:https://telegram.me/botfather[BotFather] provides an
+**authorization token** corresponding to the Bot. The authorization token is a mandatory parameter
+for the camel-telegram endpoint.
+
+NOTE: In order to allow the Bot to receive all messages exchanged within a group or channel (not just
+the ones starting with a '/' character), ask the BotFather to *disable the privacy mode*, using the
+*/setprivacy* command.
+
+
+Maven users will need to add the following dependency to their `pom.xml`
+for this component:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-telegram</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+[[Telegram-URIformat]]
+URI format
+^^^^^^^^^^
+
+[source,java]
+----------------------------------------------------
+telegram:type/authorizationToken[?options]
+----------------------------------------------------
+
+You can append query options to the URI in the following format,
+`?option=value&option=value&...`
+
+[[Telegram-Options]]
+Options
+^^^^^^^
+
+// component options: START
+The Telegram component has no options.
+// component options: END
+
+
+// endpoint options: START
+The Telegram component supports 10 endpoint options which are listed below:
+
+{% raw %}
+[width="100%",cols="2s,1,1m,1m,5",options="header"]
+|=======================================================================
+| Name | Group | Default | Java Type | Description
+| type | common |  | String | *Required* The endpoint type. Currently only the 'bots' type is supported.
+| authorizationToken | common |  | String | *Required* The authorization token for using the bot (ask the BotFather) eg. 654321531:HGF_dTra456323dHuOedsE343211fqr3t-H.
+| bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| delay | consumer | 1000 | Long | Delay in milliseconds between two consecutive polls to the 'getUpdates' service.
+| limit | consumer | 100 | Integer | Limit on the number of updates that can be received in a single polling request.
+| timeout | consumer | 30 | Integer | Timeout in seconds for long polling. Put 0 for short polling or a bigger number for long polling. Long polling produces shorter response time.
+| exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| chatId | producer |  | String | The identifier of the chat that will receive the produced messages. Chat ids can be first obtained from incoming messages (eg. when a telegram user starts a conversation with a bot its client sends automatically a '/start' message containing the chat id). It is an optional parameter as the chat id can be set dynamically for each outgoing message (using body or headers).
+| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
+| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+|=======================================================================
+{% endraw %}
+// endpoint options: END
+
+
+
+[[Telegram-MessageHeaders]]
+Message Headers
+^^^^^^^^^^^^^^^
+
+[width="100%",cols="20%,80%",options="header",]
+|=======================================================================
+|Name |Description
+|`CamelTelegramChatId` |This header is used by the producer endpoint in order to
+resolve the chat id that will receive the message. The recipient chat id can be
+placed (in order of priority) in message body, in the `CamelTelegramChatId` header
+or in the endpoint configuration (`chatId` option).
+This header is also present in all incoming messages.
+
+|`CamelTelegramMediaType` |This header is used to identify the media type when
+the outgoing message is composed of pure binary data. Possible values are strings or enum values
+belonging to the `org.apache.camel.component.telegram.TelegramMediaType` enumeration.
+
+|`CamelTelegramMediaTitleCaption` |This header is used to provide a caption or title
+for outgoing binary messages.
+
+|=======================================================================
+
+[[Telegram-Usage]]
+Usage
+^^^^^
+
+The Telegram component supports both consumer and producer endpoints.
+It can also be used in *reactive chat-bot mode* (to consume, then produce messages).
+
+[[Telegram-ProducerExample]]
+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
+
+[source,java]
+---------------------------------------------------------
+from("direct:start").to("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L");
+---------------------------------------------------------
+
+or in Spring XML
+
+[source,xml]
+---------------------------------------------
+<route>
+    <from uri="direct:start"/>
+    <to uri="telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L"/>
+<route>
+---------------------------------------------
+
+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`)
+
+[width="100%",cols="40%,60%",options="header",]
+|===================================================
+| Java Type | Description
+
+| `OutgoingTextMessage` | To send a text message to a chat
+| `OutgoingPhotoMessage` | To send a photo (JPG, PNG) to a chat
+| `OutgoingAudioMessage` | To send a mp3 audio to a chat
+| `OutgoingVideoMessage` | To send a mp4 video to a chat
+| `byte[]` | To send any media type supported. It requires the `CamelTelegramMediaType` header to be set to the appropriate media type
+| `String` | To send a text message to a chat. It gets converted automatically into a `OutgoingTextMessage`
+
+|===================================================
+
+
+[[Telegram-ConsumerExample]]
+Consumer Example
+^^^^^^^^^^^^^^^^
+
+The following is a basic example of how to receive all messages that telegram users are sending to the configured Bot.
+In Java DSL
+
+[source,java]
+---------------------------------------------------------
+from("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L")
+.bean(ProcessorBean.class)
+---------------------------------------------------------
+
+or in Spring XML
+
+[source,xml]
+---------------------------------------------
+<route>
+    <from uri="telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L"/>
+    <bean ref="myBean" />
+<route>
+
+<bean id="myBean" class="com.example.MyBean"/>
+---------------------------------------------
+
+The `MyBean` is a simple bean that will receive the messages
+
+[source,java]
+---------------------------------------------------------
+public class MyBean {
+
+    public void process(String message) {
+        // or Exchange, or org.apache.camel.component.telegram.model.IncomingMessage (or both)
+
+        // do process
+    }
+
+}
+---------------------------------------------------------
+
+
+Supported types for incoming messages are
+
+[width="100%",cols="40%,60%",options="header",]
+|===================================================
+| Java Type | Description
+
+| `IncomingMessage` | The full object representation of an incoming message
+| `String` | The content of the message, for text messages only
+
+|===================================================
+
+
+
+
+[[Telegram-ReactiveChatBot]]
+Reactive Chat-Bot Example
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The reactive chat-bot mode is a simple way of using the Camel component to build a simple
+chat bot that replies directly to chat messages received from the Telegram users.
+
+The following is a basic configuration of the chat-bot in Java DSL
+
+[source,java]
+---------------------------------------------------------
+from("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L")
+.bean(ChatBotLogic.class)
+.to("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L");
+---------------------------------------------------------
+
+or in Spring XML
+
+[source,xml]
+---------------------------------------------
+<route>
+    <from uri="telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L"/>
+    <bean ref="chatBotLogic" />
+    <to uri="telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L"/>
+<route>
+
+<bean id="chatBotLogic" class="com.example.ChatBotLogic"/>
+---------------------------------------------
+
+
+The `ChatBotLogic` is a simple bean that implements a generic String-to-String method.
+
+[source,java]
+---------------------------------------------------------
+public class ChatBotLogic {
+
+    public String chatBotProcess(String message) {
+        if( "do-not-reply".equals(message) ) {
+            return null; // no response in the chat
+        }
+
+        return "echo from the bot: " + message; // echoes the message
+    }
+
+}
+---------------------------------------------------------
+
+
+Every non-null string returned by the `chatBotProcess` method is automatically routed to the
+chat that originated the request (as the `CamelTelegramChatId` header is used to route the message).
+

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramComponent.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramComponent.java
new file mode 100644
index 0000000..4f3e0d4
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramComponent.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.UriEndpointComponent;
+
+/**
+ * The Camel component for Telegram.
+ */
+public class TelegramComponent extends UriEndpointComponent {
+
+    public TelegramComponent() {
+        super(TelegramEndpoint.class);
+    }
+
+    @Override
+    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+        TelegramConfiguration configuration = new TelegramConfiguration();
+        setProperties(configuration, parameters);
+        configuration.updatePathConfig(remaining);
+
+        if (TelegramConfiguration.ENDPOINT_TYPE_BOTS.equals(configuration.getType())) {
+            return new TelegramEndpoint(uri, this, configuration);
+        }
+
+        throw new IllegalArgumentException("Unsupported endpoint type for uri " + uri + ", remaining " + remaining);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConfiguration.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConfiguration.java
new file mode 100644
index 0000000..61e81c9
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConfiguration.java
@@ -0,0 +1,136 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram;
+
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+import org.apache.camel.spi.UriPath;
+
+/**
+ * Bean holding the configuration of the telegram component.
+ */
+@UriParams
+public class TelegramConfiguration {
+
+    public static final String ENDPOINT_TYPE_BOTS = "bots";
+
+    @UriPath(description = "The endpoint type. Currently, only the 'bots' type is supported.", enums = ENDPOINT_TYPE_BOTS)
+    @Metadata(required = "true")
+    private String type;
+
+    @UriPath(description = "The authorization token for using the bot (ask the BotFather), eg. 654321531:HGF_dTra456323dHuOedsE343211fqr3t-H.")
+    @Metadata(required = "true")
+    private String authorizationToken;
+
+    @UriParam(description = "The identifier of the chat that will receive the produced messages. Chat ids can be first obtained from incoming messages "
+            + "(eg. when a telegram user starts a conversation with a bot, its client sends automatically a '/start' message containing the chat id). "
+            + "It is an optional parameter, as the chat id can be set dynamically for each outgoing message (using body or headers).", label = "producer")
+    private String chatId;
+
+    @UriParam(description = "Delay in milliseconds between two consecutive polls to the 'getUpdates' service.", optionalPrefix = "consumer.", defaultValue = "1000", label = "consumer")
+    private Long delay = 1000L;
+
+    @UriParam(description = "Timeout in seconds for long polling. Put 0 for short polling or a bigger number for long polling. Long polling produces shorter response time.", optionalPrefix =
+            "consumer.", defaultValue = "30", label = "consumer")
+    private Integer timeout = 30;
+
+    @UriParam(description = "Limit on the number of updates that can be received in a single polling request.", optionalPrefix = "consumer.", defaultValue = "100", label = "consumer")
+    private Integer limit = 100;
+
+    public TelegramConfiguration() {
+    }
+
+    /**
+     * Sets the remaining configuration parameters available in the URI.
+     *
+     * @param remaining the URI part after the scheme
+     */
+    public void updatePathConfig(String remaining) {
+        String[] parts = remaining.split("/");
+        if (parts.length != 2) {
+            throw new IllegalArgumentException("Unexpected URI format. Expected 'bots/<authorizationToken>', found '" + remaining + "'");
+        }
+
+        String type = parts[0];
+        if (!type.equals(ENDPOINT_TYPE_BOTS)) {
+            throw new IllegalArgumentException("Unexpected endpoint type. Expected 'bots', found '" + parts[0] + "'");
+        }
+
+        String authorizationToken = parts[1];
+        if (authorizationToken.length() == 0) {
+            throw new IllegalArgumentException("Authorization token is required");
+        }
+
+        this.type = type;
+        this.authorizationToken = authorizationToken;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getAuthorizationToken() {
+        return authorizationToken;
+    }
+
+    public void setAuthorizationToken(String authorizationToken) {
+        this.authorizationToken = authorizationToken;
+    }
+
+    public String getChatId() {
+        return chatId;
+    }
+
+    public void setChatId(String chatId) {
+        this.chatId = chatId;
+    }
+
+    public Long getDelay() {
+        return delay;
+    }
+
+    public void setDelay(Long delay) {
+        this.delay = delay;
+    }
+
+    public Integer getTimeout() {
+        return timeout;
+    }
+
+    public void setTimeout(Integer timeout) {
+        this.timeout = timeout;
+    }
+
+    public Integer getLimit() {
+        return limit;
+    }
+
+    public void setLimit(Integer limit) {
+        this.limit = limit;
+    }
+
+    @Override
+    public String toString() {
+        return "TelegramConfiguration{" + "type='" + type + '\'' + ", authorizationToken='" + authorizationToken + '\'' + ", chatId='" + chatId + '\'' + ", delay=" + delay
+                + ", timeout=" + timeout + ", limit=" + limit + '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConstants.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConstants.java
new file mode 100644
index 0000000..ad3932b
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConstants.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram;
+
+/**
+ * Useful constants for the Telegram component.
+ */
+public final class TelegramConstants {
+
+    public static final String TELEGRAM_CHAT_ID = "CamelTelegramChatId";
+
+    public static final String TELEGRAM_MEDIA_TYPE = "CamelTelegramMediaType";
+
+    public static final String TELEGRAM_MEDIA_TITLE_CAPTION = "CamelTelegramMediaTitleCaption";
+
+
+    private TelegramConstants() {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConsumer.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConsumer.java
new file mode 100644
index 0000000..5935d9f
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConsumer.java
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.OptionalLong;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.component.telegram.model.Update;
+import org.apache.camel.component.telegram.model.UpdateResult;
+import org.apache.camel.impl.ScheduledPollConsumer;
+
+/**
+ * A polling consumer that reads messages from a chat using the Telegram bot API.
+ */
+public class TelegramConsumer extends ScheduledPollConsumer {
+
+    private TelegramEndpoint endpoint;
+
+    /**
+     * Holds the current offset, used for retrieving incremental updates.
+     */
+    private volatile Long offset;
+
+    public TelegramConsumer(TelegramEndpoint endpoint, Processor processor) {
+        super(endpoint, processor);
+        setDelay(endpoint.getConfiguration().getDelay());
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    protected int poll() throws Exception {
+
+        TelegramConfiguration config = endpoint.getConfiguration();
+
+        Long realOffset = offset != null ? offset : 0L;
+
+        TelegramService service = TelegramServiceProvider.get().getService();
+
+        log.debug("Polling Telegram service to get updates");
+
+        UpdateResult updateResult = service.getUpdates(config.getAuthorizationToken(), offset, config.getLimit(), config.getTimeout());
+        if (updateResult.getUpdates() == null) {
+            // to simplify processing
+            updateResult.setUpdates(Collections.emptyList());
+        }
+
+        if (!updateResult.isOk()) {
+            throw new IllegalStateException("The server was unable to process the request. Response was " + updateResult);
+        }
+
+        List<Update> updates = updateResult.getUpdates();
+
+        if (updates.size() > 0) {
+            log.info("Received " + updates.size() + " updates from Telegram service");
+        } else {
+            log.debug("No updates received from Telegram service");
+        }
+
+        processUpdates(updates);
+
+        // update offset to prevent retrieving the same data again
+        updateOffset(updates);
+
+        return updates.size();
+    }
+
+    private void processUpdates(List<Update> updates) throws Exception {
+        for (Update update : updates) {
+
+            log.debug("Received update from Telegram service: " + update);
+
+            Exchange exchange = endpoint.createExchange();
+
+            if (update.getMessage() != null) {
+                exchange.getIn().setBody(update.getMessage());
+
+                if (update.getMessage().getChat() != null) {
+                    exchange.getIn().setHeader(TelegramConstants.TELEGRAM_CHAT_ID, update.getMessage().getChat().getId());
+                }
+            }
+            getProcessor().process(exchange);
+        }
+    }
+
+    private void updateOffset(List<Update> updates) {
+        OptionalLong ol = updates.stream().mapToLong(Update::getUpdateId).max();
+        if (ol.isPresent()) {
+            this.offset = ol.getAsLong() + 1;
+            log.debug("Next Telegram offset will be " + this.offset);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramEndpoint.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramEndpoint.java
new file mode 100644
index 0000000..8c06d18
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramEndpoint.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram;
+
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+
+/**
+ * The Camel endpoint for a telegram bot.
+ */
+@UriEndpoint(scheme = "telegram", title = "Telegram", syntax = "telegram:type/authorizationToken", consumerClass = TelegramConsumer.class, label = "chat")
+public class TelegramEndpoint extends DefaultEndpoint {
+
+    @UriParam
+    private TelegramConfiguration configuration;
+
+    public TelegramEndpoint(String endpointUri, Component component, TelegramConfiguration configuration) {
+        super(endpointUri, component);
+        this.configuration = configuration;
+    }
+
+    @Override
+    public Producer createProducer() throws Exception {
+        return new TelegramProducer(this);
+    }
+
+    @Override
+    public Consumer createConsumer(Processor processor) throws Exception {
+        return new TelegramConsumer(this, processor);
+    }
+
+    @Override
+    public boolean isSingleton() {
+        return true;
+    }
+
+    public TelegramConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(TelegramConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramMediaType.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramMediaType.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramMediaType.java
new file mode 100644
index 0000000..bab9f76
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramMediaType.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram;
+
+/**
+ * A collection of supported media type for outgoing messages (produced).
+ * It is meant to be put in the message headers using key {@link TelegramConstants#TELEGRAM_MEDIA_TYPE}.
+ */
+public enum TelegramMediaType {
+
+    TEXT("txt"), PHOTO_PNG("png"), PHOTO_JPG("jpg"), AUDIO("mp3"), VIDEO("mp4");
+
+    private String fileExtension;
+
+    TelegramMediaType(String fileExtension) {
+        this.fileExtension = fileExtension;
+    }
+
+    public String getFileExtension() {
+        return fileExtension;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramProducer.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramProducer.java
new file mode 100644
index 0000000..4f63445
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramProducer.java
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.component.telegram.model.OutgoingMessage;
+import org.apache.camel.impl.DefaultProducer;
+
+/**
+ * A producer that sends messages to Telegram through the bot API.
+ */
+public class TelegramProducer extends DefaultProducer {
+
+    private TelegramEndpoint endpoint;
+
+    public TelegramProducer(TelegramEndpoint endpoint) {
+        super(endpoint);
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    public void process(Exchange exchange) throws Exception {
+
+        if (exchange.getIn().getBody() == null) {
+            // fail fast
+            log.info("Received exchange with empty body, skipping");
+            return;
+        }
+
+        TelegramConfiguration config = endpoint.getConfiguration();
+
+        // Tries to get a message in its OutgoingMessage format
+        // Automatic conversion applies here
+        OutgoingMessage message = exchange.getIn().getBody(OutgoingMessage.class);
+
+        if (message.getChatId() == null) {
+            log.debug("Chat id is null on outgoing message, trying resolution");
+            String chatId = resolveChatId(config, message, exchange);
+            log.debug("Resolved chat id is " + chatId);
+            message.setChatId(chatId);
+        }
+
+        TelegramService service = TelegramServiceProvider.get().getService();
+
+        log.info("Sending text message to Telegram service");
+        log.debug("Message being sent is: " + message);
+        log.debug("Headers of message being sent are: " + exchange.getIn().getHeaders());
+
+        service.sendMessage(config.getAuthorizationToken(), message);
+    }
+
+    private String resolveChatId(TelegramConfiguration config, OutgoingMessage message, Exchange exchange) {
+        String chatId;
+
+        // Try to get the chat id from the message body
+        chatId = message.getChatId();
+
+        // Get the chat id from headers
+        if (chatId == null) {
+            chatId = (String) exchange.getIn().getHeader(TelegramConstants.TELEGRAM_CHAT_ID);
+        }
+
+        // If not present in the headers, use the configured value for chat id
+        if (chatId == null) {
+            chatId = config.getChatId();
+        }
+
+        // Chat id is mandatory
+        if (chatId == null) {
+            throw new IllegalStateException("Chat id is not set in message headers or route configuration");
+        }
+
+        return chatId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramService.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramService.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramService.java
new file mode 100644
index 0000000..b38f4ad
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramService.java
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram;
+
+import org.apache.camel.component.telegram.model.OutgoingMessage;
+import org.apache.camel.component.telegram.model.UpdateResult;
+
+/**
+ * Allows interacting with the Telegram server to exchange messages.
+ */
+public interface TelegramService {
+
+
+    UpdateResult getUpdates(String authorizationToken, Long offset, Integer limit, Integer timeoutSeconds);
+
+    void sendMessage(String authorizationToken, OutgoingMessage message);
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramServiceProvider.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramServiceProvider.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramServiceProvider.java
new file mode 100644
index 0000000..598be1c
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramServiceProvider.java
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram;
+
+import org.apache.camel.component.telegram.service.TelegramServiceRestBotAPIAdapter;
+
+/**
+ * Provides access to an instance of the Telegram service. It allows changing the default implementation of the service for testing purposes.
+ * Currently the Telegram API does not allow a Bot sending messages to other BOTs (https://core.telegram.org/bots/faq#why-doesn-39t-my-bot-see-messages-from-other-bots),
+ * so the service needs to be mocked for end-to-end testing.
+ *
+ * The Rest client used as default implementation is thread safe, considering the current usage of the APIs. It is treated as a singleton.
+ */
+public final class TelegramServiceProvider {
+
+    private static final TelegramServiceProvider INSTANCE = new TelegramServiceProvider();
+
+    /**
+     * The default service.
+     */
+    private final TelegramService service;
+
+    /**
+     * An alternative service used for testing purposes.
+     */
+    private TelegramService telegramService;
+
+    private TelegramServiceProvider() {
+        // Using the Rest Bot API by default
+        this.service = new TelegramServiceRestBotAPIAdapter();
+    }
+
+    /**
+     * Returns the singleton provider.
+     */
+    public static TelegramServiceProvider get() {
+        return INSTANCE;
+    }
+
+    /**
+     * Provides the current service. It can be the default one or an alternative one.
+     * @return the active {@code TelegramService}
+     */
+    public TelegramService getService() {
+        if (telegramService != null) {
+            // no need for synchronization, it's only for testing purposes
+            return telegramService;
+        }
+        return service;
+    }
+
+    /**
+     * Get the current alternative service, if any.
+     *
+     * @return the current alternative service
+     */
+    public TelegramService getAlternativeService() {
+        return telegramService;
+    }
+
+    /**
+     * Allows setting an alternative service.
+     *
+     * @param service the alternative service
+     */
+    public void setAlternativeService(TelegramService service) {
+        this.telegramService = service;
+    }
+
+    /**
+     * Restores the provider to its original state.
+     */
+    public void restoreDefaultService() {
+        this.telegramService = null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/Chat.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/Chat.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/Chat.java
new file mode 100644
index 0000000..75de354
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/Chat.java
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram.model;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Contains information about a telegram chat.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Chat implements Serializable {
+
+    private static final long serialVersionUID = 4706232811327318379L;
+
+    private String id;
+
+    private String title;
+
+    private String type;
+
+    public Chat() {
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder("Chat{");
+        sb.append("id='").append(id).append('\'');
+        sb.append(", title='").append(title).append('\'');
+        sb.append(", type='").append(type).append('\'');
+        sb.append('}');
+        return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingAudio.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingAudio.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingAudio.java
new file mode 100644
index 0000000..c4a649a
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingAudio.java
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * ontains information about an audio file.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class IncomingAudio {
+
+    private static final long serialVersionUID = 2716544815581270395L;
+
+    @JsonProperty("file_id")
+    private String fileId;
+
+    @JsonProperty("duration")
+    private Integer durationSeconds;
+
+    private String performer;
+
+    private String title;
+
+    @JsonProperty("mime_type")
+    private String mimeType;
+
+    @JsonProperty("file_size")
+    private Long fileSize;
+
+    public IncomingAudio() {
+    }
+
+    public String getFileId() {
+        return fileId;
+    }
+
+    public void setFileId(String fileId) {
+        this.fileId = fileId;
+    }
+
+    public Integer getDurationSeconds() {
+        return durationSeconds;
+    }
+
+    public void setDurationSeconds(Integer durationSeconds) {
+        this.durationSeconds = durationSeconds;
+    }
+
+    public String getPerformer() {
+        return performer;
+    }
+
+    public void setPerformer(String performer) {
+        this.performer = performer;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getMimeType() {
+        return mimeType;
+    }
+
+    public void setMimeType(String mimeType) {
+        this.mimeType = mimeType;
+    }
+
+    public Long getFileSize() {
+        return fileSize;
+    }
+
+    public void setFileSize(Long fileSize) {
+        this.fileSize = fileSize;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder("IncomingAudio{");
+        sb.append("fileId='").append(fileId).append('\'');
+        sb.append(", durationSeconds=").append(durationSeconds);
+        sb.append(", performer='").append(performer).append('\'');
+        sb.append(", title='").append(title).append('\'');
+        sb.append(", mimeType='").append(mimeType).append('\'');
+        sb.append(", fileSize=").append(fileSize);
+        sb.append('}');
+        return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingMessage.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingMessage.java
new file mode 100644
index 0000000..66e4d27
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingMessage.java
@@ -0,0 +1,135 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram.model;
+
+import java.io.Serializable;
+import java.time.Instant;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+/**
+ * A message that is exchanged with the Telegram network.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class IncomingMessage implements Serializable {
+
+    private static final long serialVersionUID = -7592193511885686637L;
+
+    @JsonProperty("message_id")
+    private Long messageId;
+
+    @JsonDeserialize(using = UnixTimestampDeserializer.class)
+    private Instant date;
+
+    private User from;
+
+    private String text;
+
+    private Chat chat;
+
+    private List<IncomingPhotoSize> photo;
+
+    private IncomingVideo video;
+
+    private IncomingAudio audio;
+
+    public IncomingMessage() {
+    }
+
+    public Long getMessageId() {
+        return messageId;
+    }
+
+    public void setMessageId(Long messageId) {
+        this.messageId = messageId;
+    }
+
+    public Instant getDate() {
+        return date;
+    }
+
+    public void setDate(Instant date) {
+        this.date = date;
+    }
+
+    public User getFrom() {
+        return from;
+    }
+
+    public void setFrom(User from) {
+        this.from = from;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    public Chat getChat() {
+        return chat;
+    }
+
+    public void setChat(Chat chat) {
+        this.chat = chat;
+    }
+
+    public List<IncomingPhotoSize> getPhoto() {
+        return photo;
+    }
+
+    public void setPhoto(List<IncomingPhotoSize> photo) {
+        this.photo = photo;
+    }
+
+    public IncomingVideo getVideo() {
+        return video;
+    }
+
+    public void setVideo(IncomingVideo video) {
+        this.video = video;
+    }
+
+    public IncomingAudio getAudio() {
+        return audio;
+    }
+
+    public void setAudio(IncomingAudio audio) {
+        this.audio = audio;
+    }
+
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder("IncomingMessage{");
+        sb.append("messageId=").append(messageId);
+        sb.append(", date=").append(date);
+        sb.append(", from=").append(from);
+        sb.append(", text='").append(text).append('\'');
+        sb.append(", chat=").append(chat);
+        sb.append(", photo=").append(photo);
+        sb.append(", video=").append(video);
+        sb.append(", audio=").append(audio);
+        sb.append('}');
+        return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingPhotoSize.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingPhotoSize.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingPhotoSize.java
new file mode 100644
index 0000000..9079ef4
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingPhotoSize.java
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram.model;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Contains information about a photo.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class IncomingPhotoSize implements Serializable {
+
+    private static final long serialVersionUID = -7793605325953618846L;
+
+    @JsonProperty("file_id")
+    private String fileId;
+
+    private Integer width;
+
+    private Integer height;
+
+    @JsonProperty("file_size")
+    private Long fileSize;
+
+    public IncomingPhotoSize() {
+    }
+
+    public String getFileId() {
+        return fileId;
+    }
+
+    public void setFileId(String fileId) {
+        this.fileId = fileId;
+    }
+
+    public Integer getWidth() {
+        return width;
+    }
+
+    public void setWidth(Integer width) {
+        this.width = width;
+    }
+
+    public Integer getHeight() {
+        return height;
+    }
+
+    public void setHeight(Integer height) {
+        this.height = height;
+    }
+
+    public Long getFileSize() {
+        return fileSize;
+    }
+
+    public void setFileSize(Long fileSize) {
+        this.fileSize = fileSize;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder("IncomingPhotoSize{");
+        sb.append("fileId='").append(fileId).append('\'');
+        sb.append(", width=").append(width);
+        sb.append(", height=").append(height);
+        sb.append(", fileSize=").append(fileSize);
+        sb.append('}');
+        return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingVideo.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingVideo.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingVideo.java
new file mode 100644
index 0000000..4d14f79
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingVideo.java
@@ -0,0 +1,122 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram.model;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Contains information about a video.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class IncomingVideo implements Serializable {
+
+    private static final long serialVersionUID = 5280714879829232835L;
+
+    @JsonProperty("file_id")
+    private String fileId;
+
+    private Integer width;
+
+    private Integer height;
+
+    @JsonProperty("duration")
+    private Integer durationSeconds;
+
+    private IncomingPhotoSize thumb;
+
+    @JsonProperty("mime_type")
+    private String mimeType;
+
+    @JsonProperty("file_size")
+    private Long fileSize;
+
+    public IncomingVideo() {
+    }
+
+    public String getFileId() {
+        return fileId;
+    }
+
+    public void setFileId(String fileId) {
+        this.fileId = fileId;
+    }
+
+    public Integer getWidth() {
+        return width;
+    }
+
+    public void setWidth(Integer width) {
+        this.width = width;
+    }
+
+    public Integer getHeight() {
+        return height;
+    }
+
+    public void setHeight(Integer height) {
+        this.height = height;
+    }
+
+    public Long getFileSize() {
+        return fileSize;
+    }
+
+    public void setFileSize(Long fileSize) {
+        this.fileSize = fileSize;
+    }
+
+    public Integer getDurationSeconds() {
+        return durationSeconds;
+    }
+
+    public void setDurationSeconds(Integer durationSeconds) {
+        this.durationSeconds = durationSeconds;
+    }
+
+    public IncomingPhotoSize getThumb() {
+        return thumb;
+    }
+
+    public void setThumb(IncomingPhotoSize thumb) {
+        this.thumb = thumb;
+    }
+
+    public String getMimeType() {
+        return mimeType;
+    }
+
+    public void setMimeType(String mimeType) {
+        this.mimeType = mimeType;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder("IncomingVideo{");
+        sb.append("fileId='").append(fileId).append('\'');
+        sb.append(", width=").append(width);
+        sb.append(", height=").append(height);
+        sb.append(", durationSeconds=").append(durationSeconds);
+        sb.append(", thumb=").append(thumb);
+        sb.append(", mimeType='").append(mimeType).append('\'');
+        sb.append(", fileSize=").append(fileSize);
+        sb.append('}');
+        return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingAudioMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingAudioMessage.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingAudioMessage.java
new file mode 100644
index 0000000..f945c04
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingAudioMessage.java
@@ -0,0 +1,97 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram.model;
+
+import java.util.Arrays;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * An outgoing audio message.
+ */
+public class OutgoingAudioMessage extends OutgoingMessage {
+
+    private static final long serialVersionUID = 2716544815581270395L;
+
+    private byte[] audio;
+
+    private String filenameWithExtension;
+
+    @JsonProperty("duration")
+    private Integer durationSeconds;
+
+    private String performer;
+
+    private String title;
+
+    public OutgoingAudioMessage() {
+    }
+
+    public byte[] getAudio() {
+        return audio;
+    }
+
+    public void setAudio(byte[] audio) {
+        this.audio = audio;
+    }
+
+    public String getFilenameWithExtension() {
+        return filenameWithExtension;
+    }
+
+    public void setFilenameWithExtension(String filenameWithExtension) {
+        this.filenameWithExtension = filenameWithExtension;
+    }
+
+    public Integer getDurationSeconds() {
+        return durationSeconds;
+    }
+
+    public void setDurationSeconds(Integer durationSeconds) {
+        this.durationSeconds = durationSeconds;
+    }
+
+    public String getPerformer() {
+        return performer;
+    }
+
+    public void setPerformer(String performer) {
+        this.performer = performer;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder("OutgoingAudioMessage{");
+        sb.append("audio(length)=").append(audio != null ? audio.length : null);
+        sb.append(", filenameWithExtension='").append(filenameWithExtension).append('\'');
+        sb.append(", durationSeconds=").append(durationSeconds);
+        sb.append(", performer='").append(performer).append('\'');
+        sb.append(", title='").append(title).append('\'');
+        sb.append('}');
+        sb.append(' ');
+        sb.append(super.toString());
+        return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingMessage.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingMessage.java
new file mode 100644
index 0000000..060e40c
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingMessage.java
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram.model;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * The superclass of all outgoing messages.
+ */
+public abstract class OutgoingMessage implements Serializable {
+
+    private static final long serialVersionUID = -5958829164103569292L;
+
+    protected String chatId;
+
+    @JsonProperty("disable_notification")
+    protected Boolean disableNotification;
+
+    @JsonProperty("reply_to_message_id")
+    protected Long replyToMessageId;
+
+    public OutgoingMessage() {
+    }
+
+    public String getChatId() {
+        return chatId;
+    }
+
+    public void setChatId(String chatId) {
+        this.chatId = chatId;
+    }
+
+    public Boolean getDisableNotification() {
+        return disableNotification;
+    }
+
+    public void setDisableNotification(Boolean disableNotification) {
+        this.disableNotification = disableNotification;
+    }
+
+    public Long getReplyToMessageId() {
+        return replyToMessageId;
+    }
+
+    public void setReplyToMessageId(Long replyToMessageId) {
+        this.replyToMessageId = replyToMessageId;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder("OutgoingMessage{");
+        sb.append("chatId='").append(chatId).append('\'');
+        sb.append(", disableNotification=").append(disableNotification);
+        sb.append(", replyToMessageId=").append(replyToMessageId);
+        sb.append('}');
+        return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingPhotoMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingPhotoMessage.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingPhotoMessage.java
new file mode 100644
index 0000000..195b672
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingPhotoMessage.java
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram.model;
+
+import java.util.Arrays;
+
+/**
+ * An outgoing photo message.
+ */
+public class OutgoingPhotoMessage extends OutgoingMessage {
+
+    private static final long serialVersionUID = -6730785675407947090L;
+
+    private byte[] photo;
+
+    private String filenameWithExtension;
+
+    private String caption;
+
+    public OutgoingPhotoMessage() {
+    }
+
+    public byte[] getPhoto() {
+        return photo;
+    }
+
+    public void setPhoto(byte[] photo) {
+        this.photo = photo;
+    }
+
+    public String getFilenameWithExtension() {
+        return filenameWithExtension;
+    }
+
+    public void setFilenameWithExtension(String filenameWithExtension) {
+        this.filenameWithExtension = filenameWithExtension;
+    }
+
+    public String getCaption() {
+        return caption;
+    }
+
+    public void setCaption(String caption) {
+        this.caption = caption;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder("OutgoingPhotoMessage{");
+        sb.append("photo(length)=").append(photo != null ? photo.length : null);
+        sb.append(", filenameWithExtension='").append(filenameWithExtension).append('\'');
+        sb.append(", caption='").append(caption).append('\'');
+        sb.append('}');
+        sb.append(' ');
+        sb.append(super.toString());
+        return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingTextMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingTextMessage.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingTextMessage.java
new file mode 100644
index 0000000..cbaf1ac
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingTextMessage.java
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * An outgoing text message.
+ */
+public class OutgoingTextMessage extends OutgoingMessage {
+
+    private static final long serialVersionUID = -8684079202025229263L;
+
+    private String text;
+
+    @JsonProperty("parse_mode")
+    private String parseMode;
+
+    @JsonProperty("disable_web_page_preview")
+    private Boolean disableWebPagePreview;
+
+    public OutgoingTextMessage() {
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    public String getParseMode() {
+        return parseMode;
+    }
+
+    public void setParseMode(String parseMode) {
+        this.parseMode = parseMode;
+    }
+
+    public Boolean getDisableWebPagePreview() {
+        return disableWebPagePreview;
+    }
+
+    public void setDisableWebPagePreview(Boolean disableWebPagePreview) {
+        this.disableWebPagePreview = disableWebPagePreview;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder("OutgoingTextMessage{");
+        sb.append("text='").append(text).append('\'');
+        sb.append(", parseMode='").append(parseMode).append('\'');
+        sb.append(", disableWebPagePreview=").append(disableWebPagePreview);
+        sb.append('}');
+        sb.append(' ');
+        sb.append(super.toString());
+        return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingVideoMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingVideoMessage.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingVideoMessage.java
new file mode 100644
index 0000000..441378e
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingVideoMessage.java
@@ -0,0 +1,108 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram.model;
+
+import java.util.Arrays;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * An outgoing video message.
+ */
+public class OutgoingVideoMessage extends OutgoingMessage {
+
+    private static final long serialVersionUID = 1617845992454497132L;
+
+    private byte[] video;
+
+    private String filenameWithExtension;
+
+    @JsonProperty("duration")
+    private Integer durationSeconds;
+
+    private Integer width;
+
+    private Integer height;
+
+    private String caption;
+
+    public OutgoingVideoMessage() {
+    }
+
+    public byte[] getVideo() {
+        return video;
+    }
+
+    public void setVideo(byte[] video) {
+        this.video = video;
+    }
+
+    public String getFilenameWithExtension() {
+        return filenameWithExtension;
+    }
+
+    public void setFilenameWithExtension(String filenameWithExtension) {
+        this.filenameWithExtension = filenameWithExtension;
+    }
+
+    public Integer getDurationSeconds() {
+        return durationSeconds;
+    }
+
+    public void setDurationSeconds(Integer durationSeconds) {
+        this.durationSeconds = durationSeconds;
+    }
+
+    public Integer getWidth() {
+        return width;
+    }
+
+    public void setWidth(Integer width) {
+        this.width = width;
+    }
+
+    public Integer getHeight() {
+        return height;
+    }
+
+    public void setHeight(Integer height) {
+        this.height = height;
+    }
+
+    public String getCaption() {
+        return caption;
+    }
+
+    public void setCaption(String caption) {
+        this.caption = caption;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder("OutgoingVideoMessage{");
+        sb.append("video(length)=").append(video != null ? video.length : null);
+        sb.append(", filenameWithExtension='").append(filenameWithExtension).append('\'');
+        sb.append(", durationSeconds=").append(durationSeconds);
+        sb.append(", width=").append(width);
+        sb.append(", height=").append(height);
+        sb.append(", caption='").append(caption).append('\'');
+        sb.append('}');
+        sb.append(' ');
+        sb.append(super.toString());
+        return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8dc984eb/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/UnixTimestampDeserializer.java
----------------------------------------------------------------------
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/UnixTimestampDeserializer.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/UnixTimestampDeserializer.java
new file mode 100644
index 0000000..3403aa0
--- /dev/null
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/UnixTimestampDeserializer.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.telegram.model;
+
+
+import java.io.IOException;
+import java.time.Instant;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A deserializer for a unix timestamp.
+ */
+public class UnixTimestampDeserializer extends JsonDeserializer<Instant> {
+
+    private Logger log = LoggerFactory.getLogger(getClass());
+
+    @Override
+    public Instant deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
+        try {
+            Long unixTimestamp = Long.parseLong(jsonParser.getText());
+
+            return Instant.ofEpochSecond(unixTimestamp);
+        } catch (Exception e) {
+            log.warn("Unable to deserialize the unix timestamp " + jsonParser.getText(), e);
+            return null;
+        }
+    }
+}