channels.exportMessageLink

Get link and embed info of a message in a channel/supergroup

Example

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

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result = await client.invoke(new Api.channels.exportMessageLink({
        grouped: true,
        thread: true,
        channel: new Api.InputChannel({...}),
        id: 2398972,
        }));
    console.log(result); // prints the result
})();

TL schema

exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;
---functions---
channels.exportMessageLink#e63fadeb flags:# grouped:flags.0?true thread:flags.1?true channel:InputChannel id:int = ExportedMessageLink;

Parameters

Name

Type

Description

flags

grouped

Whether to include other grouped media (for albums)

thread

Whether to also include a thread ID, if available, inside of the link

channel

Channel

id

Message ID

Result

ExportedMessageLink

Possible errors

Code

Type

Description

400

CHANNEL_INVALID

The provided channel is invalid

400

CHANNEL_PRIVATE

You haven't joined this channel/supergroup

400

MESSAGE_ID_INVALID

The provided message id is invalid

400

MSG_ID_INVALID

Invalid message ID provided

Can bots use this methd ?

yes

How to handle channels, supergroups, groups, and what's the difference between them.

Last updated