class Telecr::Webhook::Server

Overview

Webhook server that listens for Telegram updates via HTTPS

Defined in:

webhook/webhook.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(bot : Bot, port : Int32 | Nil = nil, host : String = "0.0.0.0", secret_token : String | Nil = nil, logger : Logger | Nil = nil, ssl : Bool | Hash(Symbol, String) | Nil = nil) #

[View source]

Instance Method Detail

def bot : Telecr::Core::Bot #

Core properties


[View source]
def delete_webhook #

Delete the current webhook

@return [nil]


[View source]
def get_webhook_info #

Get current webhook information from Telegram

@return [JSON::Any] Webhook status information


[View source]
def handle_request(context : HTTP::Server::Context) #

Handle incoming HTTP requests

@param context [HTTP::Server::Context] The HTTP request context @return [nil]


[View source]
def handle_webhook_request(context : HTTP::Server::Context) #

Process incoming webhook from Telegram

@param context [HTTP::Server::Context] The HTTP request context @return [nil]


[View source]
def health_endpoint(context : HTTP::Server::Context) #

Health check endpoint for monitoring services

@param context [HTTP::Server::Context] The HTTP request context @return [nil]


[View source]
def host : String #

[View source]
def logger : Log #

[View source]
def port : Int32 #

[View source]
def run #

Start the webhook server

@return [nil]


[View source]
def running : Bool #

[View source]
def running? : Bool #

Check if server is currently running

@return [Bool] True if server is active


[View source]
def secret_token : String #

[View source]
def server : HTTP::Server | Nil #

[View source]
def set_webhook(**options) #

Set the webhook URL with Telegram

@param options [Hash] Additional webhook options @option options [Int32] :max_connections (40) Maximum simultaneous connections @option options [Array(String)] :allowed_updates Update types to receive @option options [Int32] :drop_pending_updates Drop pending updates on set @return [String] The webhook URL that was set


[View source]
def ssl_context : OpenSSL::SSL::Context::Server | Nil #

[View source]
def ssl_mode : Symbol #

[View source]
def stop #

Register webhook URL with Telegram

@return [nil] Stop the webhook server gracefully

@return [nil]


[View source]
def webhook_url : String #

Generate the full webhook URL based on SSL mode

@return [String] The complete webhook URL including secret token


[View source]