Telegram Bot API
🌐 فارسی

savePreparedInlineMessage

دسته‌بندی: سایر · Bot API 10.3 · مستندات رسمی

پیام اینلاین آماده را ذخیره می‌کند.

مقدار بازگشتی: در صورت موفقیت، PreparedInlineMessage برمی‌گرداند.

پارامترها

پارامترنوعالزامیتوضیحات
user_idIntegerبلهشناسه کاربر
resultInlineQueryResultبلهآبجکت JSON از نوع InlineQueryResult
allow_user_chatsBooleanاختیاریاجازه چت با کاربران
allow_bot_chatsBooleanاختیاریاجازه چت با ربات‌ها
allow_group_chatsBooleanاختیاریاجازه گروه‌ها
allow_channel_chatsBooleanاختیاریاجازه کانال‌ها

توضیحات پارامترها خلاصه‌اند؛ متن کامل را در مستندات رسمی ببینید.

نمونه درخواست

curl

curl -s -X POST "https://api.telegram.org/bot$TOKEN/savePreparedInlineMessage" \
  -H "Content-Type: application/json" \
  -d '{
  "user_id": 123456789,
  "result": {
    "type": "article",
    "id": "1",
    "title": "Hello",
    "input_message_content": {
      "message_text": "Hello!"
    }
  }
}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/savePreparedInlineMessage",
    json={
        "user_id": 123456789,
        "result": {
            "type": "article",
            "id": "1",
            "title": "Hello",
            "input_message_content": {
                "message_text": "Hello!"
            }
        }
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/savePreparedInlineMessage`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "user_id": 123456789,
    "result": {
      "type": "article",
      "id": "1",
      "title": "Hello",
      "input_message_content": {
        "message_text": "Hello!"
      }
    }
  }),
});
console.log(await res.json());

راهنمای گام‌به‌گام: ساخت ربات تلگرام: آموزش قدم‌به‌قدم از BotFather تا اولین پیام با Python