GramJS

messages.SetBotShippingResults

If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the bot will receive an updateBotShippingQuery update. Use this method to reply to shipping queries.

Example

const { Api, TelegramClient } = require("telegram");
const { StringSession } = require("telegram/sessions");

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result = await client.invoke(
    new Api.messages.SetBotShippingResults({
      queryId: BigInt("-4156887774564"),
      error: "some string here",
      shippingOptions: [
        new Api.ShippingOption({
          id: "some string here",
          title: "My very normal title",
          prices: [
            new Api.LabeledPrice({
              label: "some string here",
              amount: BigInt("-4156887774564"),
            }),
          ],
        }),
      ],
    })
  );
  console.log(result); // prints the result
})();
import { Api, TelegramClient } from "telegram";
import { StringSession } from "telegram/sessions";

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result: Api.Bool = await client.invoke(
    new Api.messages.SetBotShippingResults({
      queryId: BigInt("-4156887774564"),
      error: "some string here",
      shippingOptions: [
        new Api.ShippingOption({
          id: "some string here",
          title: "My very normal title",
          prices: [
            new Api.LabeledPrice({
              label: "some string here",
              amount: BigInt("-4156887774564"),
            }),
          ],
        }),
      ],
    })
  );
  console.log(result); // prints the result
})();

Parameters

NameTypeDescription
flags#Flags, see TL conditional fields
queryIdlongUnique identifier for the query to be answered
errorflags.0?stringError message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable"). Telegram will display this message to the user.
shippingOptionsflags.1?Vector<ShippingOption>A vector of available shipping options.

Result

Bool

Possible errors

CodeTypeDescription
400QUERY_ID_INVALIDThe query ID is invalid.

Can bots use this method?

Yes

updateBotShippingQuery

This object contains information about an incoming shipping query.