Programming language: Swift
Tags: Bots    
Latest version: v1.0.0-alpha.2

Telegrammer alternatives and similar libraries

Based on the "Bots" category

Do you think we are missing an alternative of Telegrammer or a related project?

Add another 'Bots' Library



Telegram Bot Framework written in Swift 5.0 with SwiftNIO network framework

Build Version Language Platform License

What does it do • Documentation • HOWTO Guides • Usage without Vapor • Usage with Vapor • Demo bots • Requirements • Contributing • Author •

What does it do

Telegrammer is open-source framework for Telegram Bots developers. It was built on top of Apple/SwiftNIO which help to demonstrate excellent performance.

SwiftNIO is a cross-platform asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers and clients.

Also Telegrammer use some submodules of Vapor 3 server side swift framework

Join to our Telegram developers chat

Join to our Telegrammer channel on Vapor Discord server

It's easy, from scratch


import Telegrammer

let bot = try! Bot(token: "BOT_TOKEN_HERE")

let commandHandler = CommandHandler(commands: ["/hello"], callback: { (update, _) in
    guard let message = update.message, let user = message.from else { return }
    try! message.reply(text: "Hello \(user.firstName)", from: bot)

let dispatcher = Dispatcher(bot: bot)
dispatcher.add(handler: commandHandler)

_ = try! Updater(bot: bot, dispatcher: dispatcher).startLongpolling().wait()


HOWTO Guides

Usage without Vapor

  1. Create package with Swift Package Manager (SPM) $ mkdir MyBot $ cd MyBot $ swift package init --type executable
  2. Define Dependencies in Package.swift file swift let package = Package( name: "MyBot", dependencies: [ .package(url: "https://github.com/givip/Telegrammer.git", from: "0.5.0") ], targets: [ .target( name: "MyBot", dependencies: ["Telegrammer"]) ] )
  3. Resolve dependencies $ swift package resolve
  4. Generate XCode project (for macOS only) $ swift package generate-xcodeproj
  5. Open in XCode (for macOS only) $ open MyBot.xcodeproj You project is ready to create new Telegram Bot.

If you need more help through this steps, you can read How to create a Telegram bot with Telegrammer on Ubuntu / macOS

Usage with Vapor

You may also use previous way to create project with Vapor, only include Vapor as dependency in Package.swift

  1. Install Vapor CLI $ brew install vapor/tap/vapor
  2. Create Vapor project with Telegrammer template $ vapor new MyBot --template=https://github.com/givip/telegram-bot-template
  3. Generate XCode project $ vapor xcode

Demo bots

All sample bots

  1. Add Telegram Token in Environment Variables, so, either create an environment variable: $ export TELEGRAM_BOT_TOKEN='000000000:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
  2. Run Bot executable scheme or $ swift run

EchoBot sources Starts/stops with command "/echo", then simply responds with your message

HelloBot sources Says "Hello" to new users in group. Responds with "hello" message on command "/greet"

SchedulerBot sources Demonstrate Jobs Queue scheduling mechanism. Command "/start X" starts repeatable job, wich will send you a message each X seconds. Command "/once X" will send you message once after timeout of X seconds. Command "/stop" stops JobsQueue only for you. Other users continues to receive scheduled messages.

SpellCheckerBot sources Demonstrate how works InlineMenus and Callback handlers. Command "/start" will start bot. Send any english text to bot and it will be checked for mistakes. Bot will propose you some fixes in case of found mistake.





Givi Pataridze

pataridzegivi@gmail.com [@givip](tg://user?id=53581534)

*Note that all licence references and agreements mentioned in the Telegrammer README section above are relevant to that project's source code only.