Create a Bot with BotFather
BotFather is an official tool that lets you create bots on Telegram. So how do you create a Telegram bot with BotFather?
-
- Find the @BotFather account in the Telegram app and start a chat.
-
- Type the command /newbot and press Enter.
-
- Give your bot a name (for example: “YILDIZHANPOS_bot”).
-
- Create a unique username for the bot (for example: “denemebot123”).
-
- BotFather will provide you with an API token. This token is required to connect your bot to the Telegram API.
Enter the created Bot and press the Start button.
Then you will need a Chat ID.
When you search by typing 'Get My ChatID'
in the search tab in Telegram, the Bot will appear in the search results. Log in to the Bot and give /start, the bot will send you your chat_id.
Printer Template
Name : Telegram Printer Template
[LAYOUT]
<L>꧁༺ 𝓨𝓘𝓛𝓓𝓘𝓩𝓗𝓐𝓝𝓟𝓞𝓢 ༻꧂
<L00>📅<b>{TICKET DATE}</b> - ⏱️<b>{TICKET TIME}</b> - 📝 <b>{TICKET ID}</b>
<L00>👱♂️ <b>{ENTITY NAME:Customers}</b>
<L00>📱 <b>{ENTITY DATA:Customers:Phone}</b>
<L00>🏠 <b>{ENTITY DATA:Customers:Address}</b>
[='{NOTE}'!=''?'<L00>💬 <b>{NOTE}</b>':'']
<L00>----------------------------------------------------------
{ORDERS}
<F>=
<L00><b>Total: {TICKET TOTAL}</b> ₺
<F>=
<L00><a href="https://www.google.com/maps/dir/My%20Location/[='{ENTITY DATA:Customers:Address}'.replace(/ /g,'-')]">Konum için TIKLA</a>
[ORDERS]
<J00>* {QUANTITY} {NAME}|{TOTAL PRICE}
{ORDER TAGS}
[ORDERS:Void]
[ORDER TAGS]
-- Format for order tags
<L00><i> - {ORDER TAG NAME} {ORDER TAG PRICE} </i>
Script
function send(id){
var token = '8128490835:AAE3NlIkTu9rpbsC7SMx44RwhpA5ckOxSBQ';
var chatid = ' chat_id';
var fis = JSON.parse(gql.Exec('query q {getTicketPrintContent(name: "Telegram Printer Template" , width: 30 , id: '+id+')}')).data.getTicketPrintContent;
return web.PostJson('https://api.telegram.org/bot'+token+'/sendMessage?chat_id='+chatid+'&parse_mode=html&text='+fis+'','');
}