Method: Telegrammer::Bot#send_chat_action

Defined in:
lib/telegrammer/bot.rb

#send_chat_action(params) ⇒ Telegrammer::ApiResponse

Sends a status action to a user or group chat.

Used when you need to tell the user that something is happening on the bot’s side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status).

Examples:

bot = Telegrammer::Bot.new('[YOUR TELEGRAM TOKEN]')
bot.send_chat_action(chat_id: 123456789, action: "typing")

Options Hash (params):

  • :chat_id (Integer, String)

    Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername).

  • :action (String)

    Required. Type of action to broadcast. Choose one, depending on what the user is about to receive: “typing” for text messages, “upload_photo” for photos, “record_video” or “upload_video” for videos, “record_audio” or “upload_audio” for audio files, “upload_document” for general files, “find_location” for location data.

Raises:



396
397
398
399
400
401
402
403
# File 'lib/telegrammer/bot.rb', line 396

def send_chat_action(params)
  params_validation = {
    chat_id: { required: true, class: [Fixnum, String] },
    action: { required: true, class: [String] }
  }

  api_request('sendChatAction', params, params_validation)
end