CF Workers Telegram Bot
    Preparing search index...

    Module @codebam/cf-workers-telegram-bot


    CF Workers Telegram Bot

    Docs

    GitHub stars GitHub issues GitHub forks npm version

    screenshot of cf-workers-telegram-bot

    npm i @codebam/cf-workers-telegram-bot
    

    See cwtb-consumer for an example of what a bot might look like. Just import from @codebam/cf-workers-telegram-bot.

    See my blog post for a more in-depth guide for how to set up a bot.

    • npm create cloudflare@latest
    • npx wrangler login
    • npx wrangler secret put SECRET_TELEGRAM_API_TOKEN, set it to your telegram bot token that you got from @BotFather
    • npx wrangler deploy
    • Open this url in your browser to set your webhook https://your-worker.username.workers.dev/SECRET_TELEGRAM_API_TOKEN?command=set

    To set up GitHub actions to deploy when you push, see https://github.com/cloudflare/wrangler-action


    These instructions are for if you want to deploy a copy of the bot along with the library. Such as if you need extra API requests that haven't been implemented yet.

    Deploy to Cloudflare Workers

    • Click the deploy button

    • Navigate to your new GitHub repository > Settings > Secrets and add the following secrets:

      - Name: CLOUDFLARE_API_TOKEN  (should be added automatically)
      - Name: CLOUDFLARE_ACCOUNT_ID (should be added automatically)

      - Name: SECRET_TELEGRAM_API_TOKEN
      - Value: your-telegram-bot-token
    • Push to master to trigger a deploy

    Classes

    TelegramApi
    TelegramBot
    TelegramExecutionContext
    TelegramInlineQueryResult
    TelegramInlineQueryResultArticle
    TelegramInlineQueryResultPhoto
    TelegramInlineQueryResultVideo
    TelegramUpdate
    Webhook

    Interfaces

    AnswerCallbackParams
    AnswerGuestParams
    AnswerInlineParams
    AnswerPreCheckoutParams
    ChatPermissions
    PartialTelegramUpdate
    SendChatActionParams
    SendInvoiceParams
    SendMessageDraftParams
    SendMessageParams
    SendPhotoParams
    SendVideoParams
    TelegramApiBaseParams
    TelegramBusinessMessage
    TelegramCallbackQuery
    TelegramChat
    TelegramDocument
    TelegramFrom
    TelegramGuestMessage
    TelegramInlineQuery
    TelegramInputMessageContent
    TelegramMessage
    TelegramMessageEntity
    TelegramPhotoSize
    TelegramPreCheckoutQuery
    TelegramSuccessfulPayment
    TelegramUser

    Type Aliases

    TelegramApiParams
    TelegramCommand
    TelegramInlineQueryType

    References

    default → TelegramBot