This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 99692d9 Removed telegram bot key from doc 99692d9 is described below commit 99692d942ea979ce5b0c3531b6f16f8c397ac209 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Wed Jul 18 09:17:07 2018 +0200 Removed telegram bot key from doc --- .../src/main/docs/telegram-component.adoc | 50 +++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/components/camel-telegram/src/main/docs/telegram-component.adoc b/components/camel-telegram/src/main/docs/telegram-component.adoc index 5efe773..ff6e2c3 100644 --- a/components/camel-telegram/src/main/docs/telegram-component.adoc +++ b/components/camel-telegram/src/main/docs/telegram-component.adoc @@ -31,9 +31,9 @@ for this component: </dependency> ------------------------------------------------------------ -### URI format +=== URI format -[source,java] +[source,text] ---------------------------------------------------- telegram:type/authorizationToken[?options] ---------------------------------------------------- @@ -41,7 +41,7 @@ telegram:type/authorizationToken[?options] You can append query options to the URI in the following format, `?option=value&option=value&...` -### Options +=== Options // component options: START The Telegram component supports 2 options, which are listed below. @@ -132,7 +132,7 @@ The component supports 3 options, which are listed below. -### Message Headers +=== Message Headers [width="100%",cols="20%,80%",options="header",] |======================================================================= @@ -154,12 +154,12 @@ for outgoing binary messages. |======================================================================= -### 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). -### Producer Example +=== Producer Example The following is a basic example of how to send a message to a Telegram chat through the Telegram Bot API. @@ -168,7 +168,7 @@ in Java DSL [source,java] --------------------------------------------------------- -from("direct:start").to("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L"); +from("direct:start").to("telegram:bots/123456789:insertYourAuthorizationTokenHere"); --------------------------------------------------------- or in Spring XML @@ -177,11 +177,11 @@ or in Spring XML --------------------------------------------- <route> <from uri="direct:start"/> - <to uri="telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L"/> + <to uri="telegram:bots/123456789:insertYourAuthorizationTokenHere"/> <route> --------------------------------------------- -The code `123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L` is the *authorization token* corresponding to the Bot. +The code `123456789:insertYourAuthorizationTokenHere` 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`) @@ -201,14 +201,14 @@ The following message bodies are allowed for a producer endpoint (messages of ty |=================================================== -### Consumer Example +=== 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") +from("telegram:bots/123456789:insertYourAuthorizationTokenHere") .bean(ProcessorBean.class) --------------------------------------------------------- @@ -217,7 +217,7 @@ or in Spring XML [source,xml] --------------------------------------------- <route> - <from uri="telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L"/> + <from uri="telegram:bots/123456789:insertYourAuthorizationTokenHere"/> <bean ref="myBean" /> <route> @@ -254,7 +254,7 @@ Supported types for incoming messages are -### Reactive Chat-Bot Example +=== 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. @@ -263,9 +263,9 @@ 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") +from("telegram:bots/123456789:insertYourAuthorizationTokenHere") .bean(ChatBotLogic.class) -.to("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L"); +.to("telegram:bots/123456789:insertYourAuthorizationTokenHere"); --------------------------------------------------------- or in Spring XML @@ -273,9 +273,9 @@ or in Spring XML [source,xml] --------------------------------------------- <route> - <from uri="telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L"/> + <from uri="telegram:bots/123456789:insertYourAuthorizationTokenHere"/> <bean ref="chatBotLogic" /> - <to uri="telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L"/> + <to uri="telegram:bots/123456789:insertYourAuthorizationTokenHere"/> <route> <bean id="chatBotLogic" class="com.example.ChatBotLogic"/> @@ -303,7 +303,7 @@ public class ChatBotLogic { 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). -### Getting the Chat ID +=== Getting the Chat ID If you want to push messages to a specific Telegram chat when an event occurs, you need to retrieve the corresponding chat ID. The chat ID is not currently shown in the telegram client, @@ -313,7 +313,7 @@ First, add the bot to the chat where you want to push messages, then run a route [source,java] --------------------------------------------------------- -from("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L") +from("telegram:bots/123456789:insertYourAuthorizationTokenHere") .to("log:INFO?showHeaders=true"); --------------------------------------------------------- @@ -326,18 +326,18 @@ Once you get the chat ID, you can use the following sample route to push message --------------------------------------------------------- from("timer:tick") .setBody().constant("Hello") -to("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L?chatId=123456") +to("telegram:bots/123456789:insertYourAuthorizationTokenHere?chatId=123456") --------------------------------------------------------- Note that the corresponding URI parameter is simply `chatId`. -### Customizing keyboard +=== Customizing keyboard You can customize the user keyboard instead of asking him to write an option. `OutgoingTextMessage` has the property `ReplyKeyboardMarkup` which can be used for such thing. [source,java] --------------------------------------------------------- -from("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L") +from("telegram:bots/123456789:insertYourAuthorizationTokenHere") .process(exchange -> { OutgoingTextMessage msg = new OutgoingTextMessage(); @@ -364,14 +364,14 @@ from("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_d exchange.getIn().setBody(msg); }) - .to("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L"); + .to("telegram:bots/123456789:insertYourAuthorizationTokenHere"); --------------------------------------------------------- If you want to disable it the next message must have the property `removeKeyboard` set on `ReplyKeyboardMarkup` object. [source,java] --------------------------------------------------------- -from("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L") +from("telegram:bots/123456789:insertYourAuthorizationTokenHere") .process(exchange -> { OutgoingTextMessage msg = new OutgoingTextMessage(); @@ -385,5 +385,5 @@ from("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_d exchange.getIn().setBody(msg); }) - .to("telegram:bots/123456789:AAE_dLq5C19xwGjw3yiC2NvEUrZcejK21-Q987654321:AAE_dLq5C19xwOmg5yiC2NvSrkT3wj5Q1-L"); + .to("telegram:bots/123456789:insertYourAuthorizationTokenHere"); ---------------------------------------------------------