AtlasChat / Developers

Bot API reference

Build bots that receive updates, respond to messages, and work in AtlasChat groups and channels.

Quickstart

  1. Open the verified @BotFather in AtlasChat. Send /newbot and follow the prompts to choose a display name and a username ending in bot.
  2. Open the one-time token link within two minutes. If it expires, send /token @yourbot for a new one. Save the token in your server’s secret store and expose it to your app as ATLAS_BOT_TOKEN.
  3. Run the request below. The response identifies the bot attached to the token.
Shell · Check your token
export BOT_API="https://atlaspixel.ir/bot${ATLAS_BOT_TOKEN}"
curl --fail-with-body "$BOT_API/getMe"
JSON · Example response
{
  "ok": true,
  "result": {
    "id": 123456789,
    "is_bot": true,
    "first_name": "Build Bot",
    "username": "build_bot"
  }
}

Use /mybots to list your bots and /cancel to cancel a setup in progress. To edit a profile, use /setname @yourbot | New name or /setdescription @yourbot | New description. Use /revoke @yourbot to disable a leaked token. Issuing a token with /token invalidates the previous one.

Requests and errors

Call a method at the HTTPS URL below. Use GET query parameters for simple lookups, POST JSON for structured data, or multipart form data for file uploads. Methods that accept simple fields also support URL-encoded form inputs. Use POST for operations that change state.

API endpoint
https://atlaspixel.ir/bot<TOKEN>/<METHOD>

Success responses contain ok: true and a result. API errors contain ok: false, an integer error_code, and a human-readable description. Keep the full request URL out of logs because its path contains the token.

StatusMeaningWhat to check
400Invalid parameters or targetCheck input types, chat and message IDs, file limits, or callback expiry.
401UnauthorizedCheck whether the token was revoked or replaced.
403ForbiddenCheck chat access, membership and posting rights.
404Unknown method or file routeCheck the method against the reference below.
409Webhook activeCall deleteWebhook before polling.
500Server errorBack off. After an ambiguous send failure, check whether the message arrived before retrying.

Receiving updates

Each update contains an update_id and one event field. Use the update ID to deduplicate retries. Pending update payloads are retained for up to 24 hours.

FieldWhen it arrives
messagePrivate text and supported attachments, or slash commands in a group or supergroup. Use /command@yourbot to target a specific bot. Topic commands include message_thread_id.
channel_postA text post in a broadcast channel the bot has joined. Use sender_chat for channel attribution.
callback_queryA press on a callback-data button. Read id, data, from and the original message.

Long polling

Send your bot a message in AtlasChat, then call getUpdates. Save the last processed ID and request offset = last_processed_id + 1 after processing succeeds. Leave your HTTP client enough time for the server’s long poll.

Shell · Poll for updates
curl --fail-with-body "$BOT_API/getUpdates?timeout=30&limit=20"
JSON · Incoming update
{
  "update_id": 501,
  "message": {
    "message_id": 27,
    "date": 1796100000,
    "from": {
      "id": 123456789,
      "is_bot": false,
      "first_name": "Nina"
    },
    "chat": {
      "id": 123456789,
      "type": "private"
    },
    "text": "/start"
  }
}

HTTPS webhooks

Register a public HTTPS endpoint. AtlasChat sends one update as a JSON POST and adds X-Telegram-Bot-Api-Secret-Token if you supplied a secret. Validate the header, durably accept or deduplicate the update, then return a 2xx promptly. Failed deliveries are retried. Use port 443, 80, 88 or 8443 with HTTPS and a trusted certificate. Call getWebhookInfo to inspect the pending count and last failure time.

Shell · Register a webhook
curl --fail-with-body "$BOT_API/setWebhook" \
  --data-urlencode "url=https://bots.example.com/incoming" \
  --data-urlencode "secret_token=$ATLAS_WEBHOOK_SECRET"

Polling and webhooks are mutually exclusive. When switching, set drop_pending_updates only if you intend to discard the existing queue.

Recipes

Reply with an inline button

Replace the sample ID with message.chat.id from an update, or use channel_post.chat.id for a channel. Each button takes one HTTP(S) url or callback_data of 1–64 UTF-8 bytes. For callback buttons, send answerCallbackQuery with the update’s callback ID.

Shell · Send a message with an inline button
curl --fail-with-body "$BOT_API/sendMessage" \
  -H "Content-Type: application/json" \
  -d '{"chat_id":123456789,"text":"Build complete.",
       "reply_markup":{"inline_keyboard":[[
         {"text":"Acknowledge","callback_data":"ack:build-42"}
       ]]}}'

Upload a report

Use the multipart field matching the method. Save the returned attachment’s file_id if you need to download it later. Call getFile, then fetch https://atlaspixel.ir/file/bot<TOKEN>/<file_path> with the same bot’s token. For forum destinations, pass message_thread_id as an additional form field.

Shell · Upload a document
curl --fail-with-body "$BOT_API/sendDocument" \
  -F "chat_id=123456789" \
  -F "document=@./report.pdf" \
  -F "caption=Latest build report"

Register a chat-bar command

Register command names without the slash. In your handler, match the text with the slash and route the associated update to your application code.

Shell · Set the command menu
curl --fail-with-body "$BOT_API/setMyCommands" -H "Content-Type: application/json" -d '{"commands":[{"command":"start","description":"Start the bot"}]}'

Connect a Telegram-compatible SDK

Configure both the API and file base URLs. For example, with python-telegram-bot, use the following configuration and keep the requested methods within the reference below.

Python · SDK configuration
import asyncio
import os

from telegram import Bot

async def main():
    async with Bot(
        token=os.environ["ATLAS_BOT_TOKEN"],
        base_url="https://atlaspixel.ir/bot",
        base_file_url="https://atlaspixel.ir/file/bot",
    ) as bot:
        me = await bot.get_me()
        print(f"Connected as @{me.username}")

asyncio.run(main())

Identity and chats

getMe

Check the token and retrieve the authenticated bot identity.

No required parameters.

Returns User with id, is_bot, first_name and username.

getChat

Retrieve details for a private chat, group, supergroup or channel the bot can access.

ParameterTypeRequirementDescription
chat_idinteger or stringRequiredA numeric chat ID or an @username for a public channel or supergroup.

Returns Chat details, including id and type. Names, titles and usernames depend on the chat.

getChatMember

Read the status and applicable permissions of a member. Make the bot an administrator to look up other members in groups or channels.

ParameterTypeRequirementDescription
chat_idinteger or stringRequiredA numeric chat ID or an @username for a public channel or supergroup.
user_idintegerRequiredThe AtlasChat user ID. Use the bot’s getMe ID to check its own membership.

Returns Chat member object with user, status and applicable permission flags.

Messages and files

sendMessage

Send a plain-text message. For private chats, the user must contact the bot first. Group and channel sends require the appropriate membership and posting rights.

ParameterTypeRequirementDescription
chat_idinteger or stringRequiredA numeric chat ID or an @username for a public channel or supergroup.
textstringRequiredPlain text, up to 4,096 Unicode characters. Whitespace-only text is rejected.
message_thread_idintegerOptionalA forum topic ID in the target supergroup. Omit to use the default conversation.
reply_markupobjectOptionalAn inline_keyboard with URL or callback-data buttons. For multipart uploads, send the object as JSON text.

Returns Message with message_id, date, chat and text.

editMessageText

Replace the text of an eligible message. AtlasChat checks authorship and applicable channel permissions.

ParameterTypeRequirementDescription
chat_idinteger or stringRequiredA numeric chat ID or an @username for a public channel or supergroup.
message_idintegerRequiredThe message ID in the target chat. Save it from the original response or update.
textstringRequiredPlain text, up to 4,096 Unicode characters. Whitespace-only text is rejected.
reply_markupobjectOptionalAn inline_keyboard with URL or callback-data buttons. For multipart uploads, send the object as JSON text.

Returns The edited Message.

editMessageReplyMarkup

Replace or clear just the inline keyboard on an eligible message. Omit reply_markup or supply an empty inline_keyboard to clear it.

ParameterTypeRequirementDescription
chat_idinteger or stringRequiredA numeric chat ID or an @username for a public channel or supergroup.
message_idintegerRequiredThe message ID in the target chat. Save it from the original response or update.
reply_markupobjectOptionalAn inline_keyboard with URL or callback-data buttons. For multipart uploads, send the object as JSON text.

Returns The edited Message.

deleteMessage

Delete an eligible message. AtlasChat checks authorship and applicable channel permissions.

ParameterTypeRequirementDescription
chat_idinteger or stringRequiredA numeric chat ID or an @username for a public channel or supergroup.
message_idintegerRequiredThe message ID in the target chat. Save it from the original response or update.

Returns true on success.

sendPhoto

Upload a local file with multipart/form-data.

ParameterTypeRequirementDescription
chat_idinteger or stringRequiredA numeric chat ID or an @username for a public channel or supergroup.
photofileRequiredJPEG or PNG, up to 10 MiB.
captionstringOptionalPlain text, up to 1,024 characters and 4,000 UTF-8 bytes.
message_thread_idintegerOptionalA forum topic ID in the target supergroup. Omit to use the default conversation.
reply_markupobjectOptionalAn inline_keyboard with URL or callback-data buttons. For multipart uploads, send the object as JSON text.

Returns Message with the uploaded attachment, including its bot-scoped file_id.

sendDocument

Upload a local file with multipart/form-data.

ParameterTypeRequirementDescription
chat_idinteger or stringRequiredA numeric chat ID or an @username for a public channel or supergroup.
documentfileRequiredA document up to 50 MiB.
captionstringOptionalPlain text, up to 1,024 characters and 4,000 UTF-8 bytes.
message_thread_idintegerOptionalA forum topic ID in the target supergroup. Omit to use the default conversation.
reply_markupobjectOptionalAn inline_keyboard with URL or callback-data buttons. For multipart uploads, send the object as JSON text.

Returns Message with the uploaded attachment, including its bot-scoped file_id.

sendAudio

Upload a local file with multipart/form-data.

ParameterTypeRequirementDescription
chat_idinteger or stringRequiredA numeric chat ID or an @username for a public channel or supergroup.
audiofileRequiredMP3 or M4A, up to 50 MiB.
captionstringOptionalPlain text, up to 1,024 characters and 4,000 UTF-8 bytes.
message_thread_idintegerOptionalA forum topic ID in the target supergroup. Omit to use the default conversation.
reply_markupobjectOptionalAn inline_keyboard with URL or callback-data buttons. For multipart uploads, send the object as JSON text.
durationintegerOptionalAudio duration in seconds.
titlestringOptionalTrack title, up to 256 UTF-8 bytes.
performerstringOptionalArtist or performer, up to 256 UTF-8 bytes.

Returns Message with the uploaded attachment, including its bot-scoped file_id.

sendVideo

Upload a local file with multipart/form-data.

ParameterTypeRequirementDescription
chat_idinteger or stringRequiredA numeric chat ID or an @username for a public channel or supergroup.
videofileRequiredMP4, up to 50 MiB.
captionstringOptionalPlain text, up to 1,024 characters and 4,000 UTF-8 bytes.
message_thread_idintegerOptionalA forum topic ID in the target supergroup. Omit to use the default conversation.
reply_markupobjectOptionalAn inline_keyboard with URL or callback-data buttons. For multipart uploads, send the object as JSON text.
durationintegerOptionalVideo duration in seconds.
widthintegerOptionalVideo width in pixels.
heightintegerOptionalVideo height in pixels.
supports_streamingbooleanOptionalSet when the uploaded video is prepared for streaming.

Returns Message with the uploaded attachment, including its bot-scoped file_id.

getFile

Resolve a file ID returned to this bot. Download the file by appending file_path to the authenticated file URL.

ParameterTypeRequirementDescription
file_idstringRequiredUse file_id from the attachment object. The file_unique_id field is an identifier for comparison.

Returns File metadata with file_id, file_unique_id, file_size and file_path.

Polling and webhooks

getUpdates

Read pending updates. Use one polling worker per bot and persist your offset.

ParameterTypeRequirementDescription
offsetintegerOptionalPass the highest successfully processed update_id plus one. Earlier IDs are acknowledged. Defaults to 0.
limitintegerOptionalBatch size from 1 to 100. Defaults to 100.
timeoutintegerOptionalLong poll duration from 0 to 50 seconds. Defaults to 0.

Returns Array of Update objects, which can be empty. Returns HTTP 409 while a webhook is active.

setWebhook

Switch delivery to HTTPS POST. Use a public address with a trusted TLS certificate. Redirects and private network destinations are blocked.

ParameterTypeRequirementDescription
urlstringRequiredPublic HTTPS receiver URL. An empty string disables delivery.
secret_tokenstringOptionalUse a random 1–256 character value containing letters, digits, underscores or hyphens.
drop_pending_updatesbooleanOptionalDiscard the queued updates when switching delivery mode. Defaults to false.

Returns true after saving the configuration. Send a test update to verify the receiver.

getWebhookInfo

Inspect the saved webhook configuration and delivery health.

No required parameters.

Returns WebhookInfo with url, pending_update_count, has_custom_certificate and last_error_date when available.

deleteWebhook

Remove the webhook and return to polling.

ParameterTypeRequirementDescription
drop_pending_updatesbooleanOptionalDiscard the queued updates when switching delivery mode. Defaults to false.

Returns true on success.

Commands and callbacks

setMyCommands

Replace the bot’s chat-bar command menu.

ParameterTypeRequirementDescription
commandsarrayRequiredUp to 100 entries with command (1–32 lowercase letters, digits or underscores, without the slash) and description (1–256 characters). Names must be unique.
scopeobjectOptionalUse {"type":"default"} or omit.

Returns true on success.

getMyCommands

Read the default command menu.

No required parameters.

Returns Array of command and description pairs.

deleteMyCommands

Clear the default command menu.

No required parameters.

Returns true on success.

answerCallbackQuery

Acknowledge a button press promptly. A callback ID can be answered once.

ParameterTypeRequirementDescription
callback_query_idstringRequiredThe id property under callback_query.
textstringOptionalClient feedback, up to 200 characters.
show_alertbooleanOptionalDisplay the feedback as an alert. Defaults to false.

Returns true on success.

Compatibility

This reference lists the supported AtlasChat methods. Message text and captions use plain text. File sending requires a fresh multipart upload. The command menu supports the default scope. Update filtering by allowed_updates is unavailable, so filter events in your application.

Inline queries, payments, Mini Apps, business connections, bulk message mutations, sticker and poll methods, forwarding, reactions and pinning are outside the current API. AtlasChat’s messenger may offer features that are unavailable to bots.