Git Product home page Git Product logo

java-spring-telegram.spring.boot.starter's Introduction

Telegram Spring Boot Starter

build badge Maven Central Jitpack

This is a starter pom for a spring boot application with the TelegramBots Java API.

The starter is available at maven central. Just add the following dependency to your pom:

<dependency>
	<groupId>com.github.xabgesagtx</groupId>
	<artifactId>telegram-spring-boot-starter</artifactId>
	<version>0.26</version>
</dependency>

For gradle users just add this to your dependencies:

compile('com.github.xabgesagtx:telegram-spring-boot-starter:0.26')

The only thing you need to do after adding the dependency is to create a bean for a bot. E.g.:

@Component
public class Bot extends TelegramLongPollingBot {
...
} 

or for a webhook bot:

@Component
public class Bot extends TelegramWebhookBot {
... 
}

if you want to overwrite a webhook for a specific bot:

@Component
public class Bot extends CustomizableTelegramWebhookBot {
... 
}

The bot will then be registered for you automatically on startup.

Configuration

The following properties can be configured (none are mandatory):

property description available since
telegram.external-url external base url for the webhook 0.15
telegram.internal-url internal base url for the webhook 0.15
telegram.key-store keystore for the server 0.15
telegram.key-store-password keystore password for the server 0.15
telegram.path-to-certificate full path for .pem public certificate keys 0.15
telegram.proxy.type type of proxy (NO_PROXY, HTTP, SOCKS4, SOCKS5) 0.22
telegram.proxy.host host of the proxy 0.22
telegram.proxy.port port of the proxy 0.22
telegram.proxy.user username for proxy authentication 0.22
telegram.proxy.password password for proxy authentication 0.22

Webhook support

You need to configure at least telegram.external-url and telegram.internal-url for webhook support. This configuration leaves the HTTPS handling to a proxy.

If you configure telegram.key-store for your HTTPS webhook bot, you need to configure telegram.key-store-password as well.

Also, telegram.path-to-certificate will only be used, if you configure the keystore.

Proxy support

For proxy support you need to set all of the following properties:

  • telegram.proxy.type
  • telegram.proxy.host
  • telegram.proxy.port

To enable authentication for a proxy you need to set telegram.proxy.user and telegram.proxy.password.

General

In a regular spring boot setting these properties can be set in your application.properties or application.yml.

For more information on how these configuration options work, please refer to the TelegramBots Java API.

Example

An implementation example is available too.

java-spring-telegram.spring.boot.starter's People

Contributors

xabgesagtx avatar longstone avatar strench0 avatar dschulz avatar isopov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.