Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xxlabaza/telegram-api

Telegram API implementation based on Feign
https://github.com/xxlabaza/telegram-api

Last synced: 14 days ago
JSON representation

Telegram API implementation based on Feign

Awesome Lists containing this project

README

        

# Telegram API
Telegram API implementation based on Feign http client.

## Include dependency
Add the following snippet to any project's pom that depends on **telegram-api** project:
```xml


telegram-api
https://raw.github.com/xxlabaza/telegram-api/mvn-repo/

true
always

```
Then, include dependency to your project:
```xml

...

ru.xxlabaza
telegram-api
1.0.0

...

```

## Authorizing your bot
Each bot is given a unique authentication token [when it is created](https://core.telegram.org/bots#botfather). The token looks something like 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11.

## Basic usage
* Getting info about bot:
```java
TelegramService SERVICE = new TelegramService("");
User user = SERVICE.getMe().call();

Assert.assertNotNull(user.getId());
Assert.assertNotNull(user.getFirstName());
```

* Sending message:
```java
Message message = SERVICE.sendMessage()
.chat("")
.text("Hello world!")
.call();
```

* Read user's input:
```java
List updates = SERVICE.getUpdates()
.offset(10)
.limit(50)
.call();
```

For more information - read [Telegram API](https://core.telegram.org/api) and library's **JavaDoc**.