Maton

Telegram

Access the Telegram Bot API with managed authentication. Send messages, photos, polls, locations, and more through your Telegram bot.

Reference

Get Bot Info

GET /telegram/:token/getMe

Returns information about the bot.

Response:

{
  "ok": true,
  "result": {
    "id": 8523474253,
    "is_bot": true,
    "first_name": "Maton",
    "username": "maton_bot",
    "can_join_groups": true,
    "can_read_all_group_messages": true,
    "supports_inline_queries": true
  }
}

Get Updates (Long Polling)

POST /telegram/:token/getUpdates
Content-Type: application/json

{
  "limit": 100,
  "timeout": 30,
  "offset": 625435210
}
ParameterTypeRequiredDescription
offsetIntegerNoFirst update ID to return
limitIntegerNoNumber of updates (1-100, default 100)
timeoutIntegerNoLong polling timeout in seconds
allowed_updatesArrayNoUpdate types to receive

Get Webhook Info

GET /telegram/:token/getWebhookInfo

Set Webhook

POST /telegram/:token/setWebhook
Content-Type: application/json

{
  "url": "https://example.com/webhook",
  "allowed_updates": ["message", "callback_query"],
  "secret_token": "your_secret_token"
}

Delete Webhook

POST /telegram/:token/deleteWebhook
Content-Type: application/json

{
  "drop_pending_updates": true
}

Send Text Message

POST /telegram/:token/sendMessage
Content-Type: application/json

{
  "chat_id": 6442870329,
  "text": "Hello, World!",
  "parse_mode": "HTML"
}
ParameterTypeRequiredDescription
chat_idInteger/StringYesTarget chat ID or @username
textStringYesMessage text (1-4096 characters)
parse_modeStringNoHTML, Markdown, or MarkdownV2
reply_markupObjectNoInline keyboard or reply keyboard
reply_parametersObjectNoReply to a specific message

With HTML Formatting:

POST /telegram/:token/sendMessage
Content-Type: application/json

{
  "chat_id": 6442870329,
  "text": "<b>Bold</b> and <i>italic</i> with <a href=\"https://example.com\">link</a>",
  "parse_mode": "HTML"
}

With Inline Keyboard:

POST /telegram/:token/sendMessage
Content-Type: application/json

{
  "chat_id": 6442870329,
  "text": "Choose an option:",
  "reply_markup": {
    "inline_keyboard": [
      [
        {"text": "Option 1", "callback_data": "opt1"},
        {"text": "Option 2", "callback_data": "opt2"}
      ],
      [
        {"text": "Visit Website", "url": "https://example.com"}
      ]
    ]
  }
}

Send Photo

POST /telegram/:token/sendPhoto
Content-Type: application/json

{
  "chat_id": 6442870329,
  "photo": "https://example.com/image.jpg",
  "caption": "Image caption"
}
ParameterTypeRequiredDescription
chat_idInteger/StringYesTarget chat ID
photoStringYesPhoto URL or file_id
captionStringNoCaption (0-1024 characters)
parse_modeStringNoCaption parse mode

Send Document

POST /telegram/:token/sendDocument
Content-Type: application/json

{
  "chat_id": 6442870329,
  "document": "https://example.com/file.pdf",
  "caption": "Document caption"
}

Send Video

POST /telegram/:token/sendVideo
Content-Type: application/json

{
  "chat_id": 6442870329,
  "video": "https://example.com/video.mp4",
  "caption": "Video caption"
}

Send Audio

POST /telegram/:token/sendAudio
Content-Type: application/json

{
  "chat_id": 6442870329,
  "audio": "https://example.com/audio.mp3",
  "caption": "Audio caption"
}

Send Location

POST /telegram/:token/sendLocation
Content-Type: application/json

{
  "chat_id": 6442870329,
  "latitude": 37.7749,
  "longitude": -122.4194
}

Send Contact

POST /telegram/:token/sendContact
Content-Type: application/json

{
  "chat_id": 6442870329,
  "phone_number": "+1234567890",
  "first_name": "John",
  "last_name": "Doe"
}

Send Poll

POST /telegram/:token/sendPoll
Content-Type: application/json

{
  "chat_id": 6442870329,
  "question": "What is your favorite color?",
  "options": [
    {"text": "Red"},
    {"text": "Blue"},
    {"text": "Green"}
  ],
  "is_anonymous": false
}
ParameterTypeRequiredDescription
chat_idInteger/StringYesTarget chat ID
questionStringYesPoll question (1-300 characters)
optionsArrayYesPoll options (2-10 items)
is_anonymousBooleanNoAnonymous poll (default true)
typeStringNoregular or quiz
allows_multiple_answersBooleanNoAllow multiple answers
correct_option_idIntegerNoCorrect answer for quiz

Send Dice

POST /telegram/:token/sendDice
Content-Type: application/json

{
  "chat_id": 6442870329,
  "emoji": "🎲"
}

Supported emoji: 🎲 🎯 🎳 🏀 ⚽ 🎰

Edit Message Text

POST /telegram/:token/editMessageText
Content-Type: application/json

{
  "chat_id": 6442870329,
  "message_id": 123,
  "text": "Updated message text"
}

Edit Message Caption

POST /telegram/:token/editMessageCaption
Content-Type: application/json

{
  "chat_id": 6442870329,
  "message_id": 123,
  "caption": "Updated caption"
}

Edit Message Reply Markup

POST /telegram/:token/editMessageReplyMarkup
Content-Type: application/json

{
  "chat_id": 6442870329,
  "message_id": 123,
  "reply_markup": {
    "inline_keyboard": [
      [{"text": "New Button", "callback_data": "new"}]
    ]
  }
}

Delete Message

POST /telegram/:token/deleteMessage
Content-Type: application/json

{
  "chat_id": 6442870329,
  "message_id": 123
}

Forward Message

POST /telegram/:token/forwardMessage
Content-Type: application/json

{
  "chat_id": 6442870329,
  "from_chat_id": 6442870329,
  "message_id": 123
}

Copy Message

POST /telegram/:token/copyMessage
Content-Type: application/json

{
  "chat_id": 6442870329,
  "from_chat_id": 6442870329,
  "message_id": 123
}

Get Chat

POST /telegram/:token/getChat
Content-Type: application/json

{
  "chat_id": 6442870329
}

Get Chat Administrators

POST /telegram/:token/getChatAdministrators
Content-Type: application/json

{
  "chat_id": -1001234567890
}

Get Chat Member Count

POST /telegram/:token/getChatMemberCount
Content-Type: application/json

{
  "chat_id": -1001234567890
}

Get Chat Member

POST /telegram/:token/getChatMember
Content-Type: application/json

{
  "chat_id": -1001234567890,
  "user_id": 6442870329
}

Set My Commands

POST /telegram/:token/setMyCommands
Content-Type: application/json

{
  "commands": [
    {"command": "start", "description": "Start the bot"},
    {"command": "help", "description": "Get help"},
    {"command": "settings", "description": "Open settings"}
  ]
}

Get My Commands

GET /telegram/:token/getMyCommands

Delete My Commands

POST /telegram/:token/deleteMyCommands
Content-Type: application/json

{}

Get My Description

GET /telegram/:token/getMyDescription

Set My Description

POST /telegram/:token/setMyDescription
Content-Type: application/json

{
  "description": "This bot helps you manage tasks."
}

Set My Name

POST /telegram/:token/setMyName
Content-Type: application/json

{
  "name": "Task Bot"
}

Get File

POST /telegram/:token/getFile
Content-Type: application/json

{
  "file_id": "AgACAgQAAxkDAAM..."
}

Response:

{
  "ok": true,
  "result": {
    "file_id": "AgACAgQAAxkDAAM...",
    "file_unique_id": "AQAD27ExGysnfVBy",
    "file_size": 7551,
    "file_path": "photos/file_0.jpg"
  }
}

Download files from: https://api.telegram.org/file/bot<token>/<file_path>

Answer Callback Query

POST /telegram/:token/answerCallbackQuery
Content-Type: application/json

{
  "callback_query_id": "12345678901234567",
  "text": "Button clicked!",
  "show_alert": false
}

Resources

On this page