Search code examples
c#botframeworktelegram

Send sticker (using file_id, not url) with Telegram and BotFramework


Unable to send sticker using "file_id". Documentation on learn.microsoft.com comes only with sample using "url"

Trying to send like this:

activity.ChannelData = new { method = "sendSticker", parameters = new { sticker = new { file_id = "CAADAgADmwEAAoo0zQirH-KhlK1ZMwI", width = 512, height = 355 } } };
await connector.Conversations.ReplyToActivityAsync(activity);

but it does not work.


Solution

  • Same issue using Telegram.Bot api with NET 8 and C# and came across with the right way:

    Message sendSticker = await botClient.SendStickerAsync(
    chatId: chatId,
    sticker: InputFile.FromFileId("CAADAgADmwEAAoo0zQirH-KhlK1ZMwI"),
    cancellationToken: cancellationToken);
    

    More in the quickstart guide from github. Cheers.