A simple source code for the new feature of chatbots in the telegram business.
With this bot, you can set questions along with their answers so that the bot will automatically answer them in private chats.
- USDT (TRC20):
TMjkPcjmd8ZH5hmKmh5i5jvgKZPsmuP1qt
- USDT (BEP20):
0x3146df77e58F593eBee32156f7ec36926E4c33Eb
- BTC (Bitcoin):
bc1qjxtj2dtsc63emdj98scsn4t083pxrv5tg6skvf
1- Enter the bot token and the user ID of your account in the index.php file (as you know, you can get token from botFather and user ID from userinfobot):
$token = ""; // bot token
$admin = ""; // userID of your account
2- After editing and uploading to your server, it is time to set webhook. According to Telegram's documentation, to get updates related to business, you must specify the relevant updates during setwebhook for this purpose set webhook in the following way (don't forget to replace TOKEN and DOMAIN):
https://api.telegram.org/botTOKEN/setwebhook?url=DOMAIN&allowed_updates=["message","edited_message","business_connection","business_message","edited_business_message","deleted_business_messages"]
3- To add bots to your chatbots on the Telegram Business section, you must activate this feature in Botfather. To do this, select your bot from the Botfather settings section, go to Business Mode, and turn on the feature.
4- To add the bot to your account, just go to the Telegram Business section in your settings and enter the chatbot section, and enter the bot's username.
Please note: This feature is only available for premium subscription users.
You can now easily add or remove questions and answers within the bot. Once you add a question, the bot will automatically respond whenever someone types the corresponding text in your private chat.
Support for several types of content (text, photo, video, sticker, voice, etc.)
You can use html to style your text! Examples:
<b>bold</b>, <strong>bold</strong>
<i>italic</i>, <em>italic</em>
<u>underline</u>, <ins>underline</ins>
<s>strikethrough</s>, <strike>strikethrough</strike>, <del>strikethrough</del>
<span class="tg-spoiler">spoiler</span>, <tg-spoiler>spoiler</tg-spoiler>
<b>bold <i>italic bold <s>italic bold strikethrough <span class="tg-spoiler">italic bold strikethrough spoiler</span></s> <u>underline italic bold</u></i> bold</b>
<a href="http://www.example.com/">inline URL</a>
<a href="tg://user?id=123456789">inline mention of a user</a>
<tg-emoji emoji-id="5368324170671202286">👍</tg-emoji>
<code>inline fixed-width code</code>
<pre>pre-formatted fixed-width code block</pre>
<pre><code class="language-python">pre-formatted fixed-width code block written in the Python programming language</code></pre>
<blockquote>Block quotation started\nBlock quotation continued\nThe last line of the block quotation</blockquote>
<blockquote expandable>Expandable block quotation started\nExpandable block quotation continued\nExpandable block quotation continued\nHidden by default part of the block quotation started\nExpandable block quotation continued\nThe last line of the block quotation</blockquote>
- Add support for stickers, videos, photos, etc. as responses
- Automatic conversion of styles used in the text
If you run into any issues, don't hesitate to reach out to me! @MahdyarEn