Kogno
  • Introduction
  • Getting Started
    • Configuration
    • Starting the Server
    • Messenger Configuration
    • Telegram Configuration
    • WhatsApp Configuration
    • NLP Configuration
  • Conversation Class
  • Contexts
    • Blocks
      • before_anything
      • postback
      • deep_link
      • command
      • any_attachment
      • regular_expression
      • keyword
      • any_number
      • any_text
      • intent
      • entity
      • membership
      • recurring_notification
      • everything_else
      • after_all
    • Sub Contexts
    • Routing
    • Sequences
    • Conversational Forms
  • Replies / Notifications
    • text
    • button
    • quick_reply
    • raw
    • list
    • carousel
    • url
    • typing
    • image
    • video
    • html
    • markdown
    • contact
    • location
    • recurring_notification_request
    • messenger_generic_template
    • whatsapp_template
  • Templates
  • Models
    • User model
  • Scheduled Messages
  • Telegram Inline Query
  • Command Line
  • Global Methods
  • Internationalization
Powered by GitBook
On this page
  • Field Description
  • Webhook
  • Start to receiving incoming updates
  • To stop

Was this helpful?

  1. Getting Started

Telegram Configuration

PreviousMessenger ConfigurationNextWhatsApp Configuration

Last updated 2 years ago

Was this helpful?

In Order to configure this section you must have created a bot following the .

The Telegram configuration file is located at config/platforms/telegram.rb

Kogno::Application.configure do |config|

  config.telegram.bot_name = "<Your Bot Name in Telegram>"
  
  config.telegram.api_url = "https://api.telegram.org"

  config.telegram.token = "<Your token here>"

  config.telegram.webhook_https_server = "https://yourdomain.com"
  config.telegram.webhook_route = "/webhook_telegram"
  config.telegram.webhook_drop_pending_updates = true

  config.routes.inline_query = :main
  config.routes.chat_activity = :main

  config.telegram.commands = [
    {
      scope: :default,
      commands:{
        start: "Here, the command's description"
      }
    },
    # {
    #   scope: :all_private_chats,
    #   commands:{
    #     start: "Here, the command's description",
    #     command2: "Here, the command's description"
    #   }
    # }
  ]

  config.routes.commands = {
    start: :main
  }

end

Field Description

Configuration
Description

config.telegram.bot_name

Your bot's name, normally ended with the string "bot". Example: KognoBot

config.telegram.api_url

The telegram api url.

config.telegram.token

config.telegram.webhook_https_server

Your public https url for you project.

config.telegram.webhook_route

The CallBack url path where Telegram will send the notifications.

config.telegram.webhook_drop_pending_updates

Pass true to drop all pending updates after run kogno telegram webhook start.

config.routes.inline_query

config.routes.chat_activity

config.telegram.commands

Configure the bot command in the following scopes: default, all_private_chats, all_group_chats and all_chat_administrators. Run kogno telegram set_commands all to update all the bot command scopes.

config.routes.commands

Configure the context which will handle each command.

Webhook

In order to start to receive incoming updates via an outgoing webhook, you must have configured config.telegram.webhook_https_server and config.telegram.webhook_route.

Start to receiving incoming updates

kogno telegram webhook start

To stop

kogno telegram webhook stop

The will provide you with one after you have created a bot on Telegram.

Configure the default context which will handle incoming .

Configure the default context which will handle in a group or channel.

Read more in .

If isn't defined the context will be the defined in config.routes.message in the .

Telegram instructions
BotFather
inline query
changes on member status
Telegram
project's main configuration