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
Name | Type | Description |
---|---|---|
flags | # | Flags, see TL conditional fields |
queryId | long | Unique identifier for the query to be answered |
error | flags.0?string | Error 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. |
shippingOptions | flags.1?Vector<ShippingOption> | A vector of available shipping options. |
Result
Possible errors
Code | Type | Description |
---|---|---|
400 | QUERY_ID_INVALID | The query ID is invalid. |
Can bots use this method?
Yes
Related pages
updateBotShippingQuery
This object contains information about an incoming shipping query.