Swiftpack.co - Package - rapierorg/telegram-bot-swift-vapor-provider

Swift Chat Platform License

TelegramBotSDK Vapor Provider

This package is part of TelegramBotSDK

You need just to add these lines to your Vapor app:

File: Package.swift

  • Add .package(url: "https://github.com/rapierorg/telegram-bot-swift-vapor-provider.git", from: "0.2.1"),
  • Add TelegramBotSDKVaporProvider to your App target dependencies

File: configure.swift

Add the following lines to your configure function:

services.register(TelegramBotConfig(apiToken: "your-api-token-here", routerConfiguration: { (router) in
    // Configure TelegramBotSDK router here
try services.register(TelegramBotProvider())

File: routes.swift

router.post("change", "me") { (request) -> HTTPStatus in // Change route
    let telegramClient = try request.make(TelegramBotClient.self)
    try telegramClient.handleRequest(request)
    return .ok

Optional: boot.swift

let telegramClient = try app.make(TelegramBotClient.self)
telegramClient.bot.setWebhookSync(url: "your-webhook-url-here")


Stars: 1

Used By

Total: 0


Update to TelegramBotSDK v2.0.0 - 2020-03-22 12:20:26

First Working Version - 2019-08-18 18:44:42