Skip to main content

Типы результатов

Каждый элемент массива results имеет поле type. Поддерживаемые типы:

Article (статья)

Самый универсальный — пара «заголовок + текст».

{
"type": "article",
"id": "1",
"title": "Заголовок",
"description": "Под заголовком",
"thumbnail_url": "https://example.com/icon.png",
"thumbnail_width": 64,
"thumbnail_height": 64,
"input_message_content": {
"message_text": "Содержимое сообщения",
"parse_mode": "HTML"
},
"reply_markup": {
"inline_keyboard": [[{"text": "Подробнее", "url": "https://..."}]]
}
}

Photo

{
"type": "photo",
"id": "2",
"photo_url": "https://example.com/cat.jpg",
"thumbnail_url": "https://example.com/cat-thumb.jpg",
"caption": "Котик"
}

Video, Animation (GIF)

{ "type": "video", "id": "3", "video_url": "...", "mime_type": "video/mp4", "thumbnail_url": "...", "title": "Видео" }
{ "type": "gif", "id": "4", "gif_url": "...", "thumbnail_url": "..." }
{ "type": "mpeg4_gif", "id": "5", "mpeg4_url": "...", "thumbnail_url": "..." }

Audio, Voice, Document

{ "type": "audio", "audio_url": "...", "title": "Песня" }
{ "type": "voice", "voice_url": "...", "title": "Голосовое" }
{ "type": "document", "document_url": "...", "mime_type": "application/pdf", "title": "Файл.pdf" }

Location, Venue, Contact

{ "type": "location", "latitude": 55.75, "longitude": 37.62, "title": "Москва" }
{ "type": "venue", "latitude": 55.75, "longitude": 37.62, "title": "Кафе", "address": "ул. Тверская, 1" }
{ "type": "contact", "phone_number": "+71234567890", "first_name": "Иван" }

Sticker

{ "type": "sticker", "id": "7", "sticker_file_id": "AgADx..." }

Кешированные (через file_id)

Если у вас есть file_id уже загруженного на наш сервер контента — используйте *_cached_ варианты:

  • photo_cachedphoto_file_id)
  • video_cached, audio_cached, voice_cached
  • document_cached, gif_cached, mpeg4_gif_cached
  • sticker_cached

Это быстрее — Telefon не качает файл заново.

Совет

Для тяжелых медиа (видео, документы) сначала загрузите файлы один раз через обычный sendVideo/sendDocument в свой служебный чат, сохраните file_id, и потом отдавайте через *_cached в inline-результатах.