141.12. Webhook 模式
Telegram 组件支持在 webhook mode 中使用 camel-webhook 组件。
要启用 webhook 模式,用户需要首先在其应用程序中添加 REST 实现。例如,Maven 用户可将 netty-http 添加到其 pom.xml
文件中:
<dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-netty-http</artifactId> <version>{CamelSBVersion}</version> <!-- use the same version as your Camel core version --> </dependency>
完成后,您需要将 Webhook URI 添加到您要使用的 telegram URI 中。
Java DSL:
from("webhook:telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere").to("log:info");
有些端点将由您的应用程序公开,Tegram 将配置为向它们发送消息。您需要确保您的服务器可向互联网公开,并传递 camel.component.webhook.configuration.webhook-external-url 属性的正确值。
有关如何设置它的说明,请参阅 camel-webhook 组件文档。