Many Telegram bots (e.g., @youtube) have a button you can click on to forward messages sent by the bot. When the user clicks on this button, Telegram opens a contact list that lets the user choose who to forward the message to.
How can I send a button like this? The closest thing I can find is forwardMessage but that expects chat_id
target ID as a required parameter. But I won't have this target ID until the user selects who they want to forward to.
Switch to Inline buttons Pressing a switch to inline button prompts the user to select a chat, opens it and inserts the bot's username into the input field. You can also pass a query that will be inserted along with the username – this way your users will immediately get some inline results they can share.
You have to use the @BotFather bot to set the Group Privacy off. This let the bot to access all the group messages. Please note that this change is not propagated automatically, so in case the bot is already in a group before turning off privacy mode, it will remain as it was before.
TForwarder can automatically forward messages for you by keyword or without any filters from selected telegram chats to needed telegram channel or group or directly for your friend. You can use app as a distribution of messages from any telegram chats (private channels, private groups, direct chats) into one chat.
If you want to share your content to specific chats, you have 2 options:
Option 1
If your bot has inline_mode
enabled you can share content via a button that opens a inline_query
in the chat selected. Basically, this is how @youtube bot works. To use this method you need to send an inline button with switch_inline_query
as a field (documentation).
Example in Javascript:
bot.sendMessage(msg.chat.id, 'Share:', {
reply_markup: {
inline_keyboard: [[{
text: 'Share with your friends',
switch_inline_query: 'share'
}]]
}
})
This is the same example I use in my bot @livecoinbot, set a bitcoin address and use the share button.
Option 2
You can create a normal inline button or just simply send a link in a normal message, that will prompt the telegram client to share the content. Here is how you do it:
https://t.me/share/url?url=[url-to-send-here]&text=[text]
Example: Click here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With