telegram-api: Telegram Bot API bindings

[ bsd3, library, web ] [ Propose Tags ]

High-level bindings to the Telegram Bot API


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.0.1, 0.2.0.0, 0.2.1.0, 0.2.1.1, 0.3.0.0, 0.3.1.0, 0.4.0.0, 0.4.0.1, 0.4.1.0, 0.4.2.0, 0.4.3.0, 0.4.3.1, 0.5.0.0, 0.5.0.1, 0.5.1.1, 0.5.1.2, 0.5.2.0, 0.6.0.0, 0.6.0.1, 0.6.0.2, 0.6.1.0, 0.6.1.1, 0.6.2.0, 0.6.3.0, 0.7.0.0, 0.7.1.0, 0.7.2.0 (info)
Dependencies aeson, base (>=4.7 && <5), either (<5), servant (>=0.4 && <0.5), servant-client, text [details]
License BSD-3-Clause
Copyright Alexey Rodiontsev (c) 2016
Author Alexey Rodiontsev
Maintainer alex.rodiontsev@gmail.com
Revised Revision 1 made by Bodigrim at 2021-10-14T21:25:52Z
Category Web
Home page http://github.com/klappvisor/haskell-telegram-api#readme
Source repo head: git clone https://github.com/klappvisor/haskell-telegram-api
Uploaded by klappvisor at 2016-01-09T00:59:40Z
Distributions
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 17907 total (62 in the last 30 days)
Rating 2.0 (votes: 3) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-01-09 [all 1 reports]

Readme for telegram-api-0.2.0.0

[back to package description]

telegram-api

Build Status Hackage Hackage Dependencies Haskell Programming Language BSD3 License

High-level bindings to the Telegram Bots API based on servant library. Both getUpdates request or webhook can be used to receive updates for your bot. Inline mode is supported. Uploading stickers, documents, video, etc is not supported yet, but you can send items which are already uploaded on the Telegram servers.

See list of supported methods below in TODO section.

Usage

getMe example

import Control.Monad
import qualified Data.Text.IO as T
import Data.Maybe
import Telegram.API.Data
import Telegram.API.Responses
import Telegram.API.Bot

main :: IO ()
main = do
  Right GetMeResponse { user_result = u } <-
    getMe token
    T.putStrLn (user_first_name u)
  where token = Token "bot<token>" -- entire Token should be bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11

sendMessage example

import Control.Monad
import qualified Data.Text.IO as T
import Data.Maybe
import Telegram.API.Data
import Telegram.API.Requests
import Telegram.API.Responses
import Telegram.API.Bot

main :: IO ()
main = do
  Right MessageResponse { message_result = m } <-
    sendMessage token (SendMessageRequest chatId message (Just Markdown) Nothing Nothing)
    T.putStrLn (message_id m)
    T.putStrLn (text m)
  where token = Token "bot<token>" -- entire Token should be bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
        chatId = "<chat_id> or <@channelusername>" 
        message = "text *bold* _italic_ [github](github.com/klappvisor/haskell-telegram-api)"

TODO

General

  • reply_markup is skipped for all methods
  • Inline mode is not supported yet
  • Uploading of Files, Documents, Stickers, etc

Methods

Currently supported:
  • getMe
  • sendMessage
  • forwardMessage
  • sendPhoto - without upload
  • sendAudio - without upload
  • sendDocument - without upload
  • sendSticker - without upload
  • sendVideo - without upload
  • sendVoice - without upload
  • sendLocation
  • getUpdates
  • getFile
  • sendChatAction
  • getUserProfilePhotos
  • setWebhook - without uploading certificate
  • answerInlineQuery
To be done:
  • sendPhoto - upload photo
  • sendAudio - upload audio
  • sendDocument - upload documents
  • sendSticker - upload stickers
  • sendVideo - upload video
  • sendVoice - upload voice
  • setWebhook - upload certificate