how to create a bot with in telegram with botfather and using only a code? - api

There are some steps that have been mentioned in telegram api for creating a bot using a botfather.
I was hoping if there is a way that these steps can turn into code.
to be specific, I want to get a token from botfather using code, and then later in the code, I use this token.

Yes this is very possible.
You would however need to build a Telegram Client, that will interact with BotFather.
The interaction should be easy to script, as BotFather interaction follows just a few simple steps

Related

How to implement Telegram bot as a widget on your website?

I'm trying to create some sort of live chat widget, but with a Telegram bot instead of a real person on the other side. I don't know if it is possible, but ideally, there is a chat window that can be implemented on a website, and establishes a new connection with a telegram bot once you click on it. The end-user should NOT have a Telegram account. I already tried to implement Intergram but it's not exactly what I'm looking for, as it merely forwards the message to a human using webhooks, and the bot is only used as a message broker. I have heard that some customization is possible using tdlib but I'm not sure if it can help me achieve the desired result.
How should I start implementing a chat window with my bot on a website?

Telegram bot analytics

I have checked telegram bot api web but could not find analytics api for bot, is telegram provide
analytics api for bots, if yes any one have reference it will helps me a lot
the Telegram API does not provide you with a way to get analytics. It is only an interface to operate the bot automatically.
However, there are services like this:
https://www.integromat.com/en/integrations/google-analytics/telegram
You can check it out and see if it fits your needs.
Whenever you build a database you can create metrics and analytics.
To analyze statistics, Telegram Robot, you must save anyone who starts the robot in the database(json data base or mysql or etc). To do this, you can get the user id (it is easy to get the user id)

How to avoid Bot repeating command in groups?

I created a new Telegram Bot which maintains a simple list. When I chat with the Bot directly (in PMs) the Bot works as intended.
I created this bot for a group of friends, so I added the bot to the group, and now, whenever I execute a command, the bot responds, but also repeats my command. Is there any way to avoid this behavior?
I am using the python-telegram-bot API and sending messages using update.message.reply_text('My message')
Is this just intended behavior or is there any way to avoid the bot repeating the sent command?
The bot only is replying message, not creating 2 messages.
You should use send_message.
I found the solution. Telegram API understands this as quoting, and is enabled in groups by default, disabled in private chats.
It can be disabled by using:
update.message.reply_text("message", quote=False)

Bot sending an interactive google map to Telegram user

A bot wants to send a map with specific lat/lng point to a Telegram user. When clicked that map should lead user to an interactive map version.
I saw one bot (SberbankBot) can do that, but I need to know how exactly.
I'm using Python 2.7 + telepot library.
As #mymedia pointed out in comments, you can use sendLocation method of Telegram Bot APi, and using telepot:
bot.sendLocation(chat_id, latitude=lat, longitude=lon);

Telegram bots - how can we detect that a user has started typing?

We can get Telegram messages when they are complete and sent via long polling or webhooks, but is there a way to understand when the user has started typing?
I guess this is not a normal case for bots and I dont think there is a straight away method but could we fall back on the Telegram API for messaging apps for that?
Well, actually I found a solution in the current Bot API; inline queries. While they are not intended for this, inline queries send what the user types in to the bot in real-time, so you are alerted as soon as the first characters are typed in.
There is a way in Telegram Core API, named: updateUserTyping.
But there is not any way in Telegram Bot API yet (until today: 2016-10-17).
If you type or send a file to the bot during these processes you do not get any message from Telegram in your webhook, but it's possible they'll add a new feature to detect user typing in future Bot API updates.