Could Telegram Bot has private chat? - node.js

I create a Bot and it able to send messages to my groups.
Now I'd like to create an interaction with it, like keyboard and so on.
I saw some bot that before use keyboard, and after the Human starts the chat in the same chat_id.
How Can I read and write like a human using Bot? Have I save the conversation (chat_id, user_id, messages) in a database and start a chat with API?

You can send message via sendMessage method from telegram bot api ( https://api.telegram.org/bot\*BOTTOKEN\*sendmessage)
and to receive you can create api to send a message to your handler, or use getUpdates method from telegram bot api

Related

How to send the username of the message sender to the dialogflow bot in telegram?

I connected the dialogflow bot to the telegram chat and it responds to user messages but without specifying their names and periodically determines random words from the text of the message as the user names.
How to set up a dialogflow bot in the telegram chat so it receives not only messages, but the message sender user names too?
When using Dialogflow with Telegram, Telegram already provides you a unique id for every Telegram user. Try to output the body request from Telegram and then catch that uniqueid value.
I checked through the telegram webhook - the username is indeed sent to the bot with the message.
Probably the problem is in the telegram integration code of the dialogflow-es bot.

Bot one to one chat

I've created a telegram bot with some logic. The user put his request, the bot sends the response. But if there is more then 1 user in the chat, everyone see messages of other, as well as they see messages of the bot. So my question is how can I make it private?

Use a bot as a user on Telegram

I'm using https://github.com/yagop/node-telegram-bot-api and I'm able to send message to user and to my channels. I'd like to improve my bot, I want to manage the private messages that my bot receives.
At the moment when the BOT receive a message, I can save on database from my node application, but if I want to manage all messages, I need to build a backoffice.
Is it possible to read the messages from Telegram and impersonate the BOT and start a normal conversation?
Using Telegram bot, Telegram does not provide any function to retrieve old messages. BOT API does not have such feature.
What you need is to use TDlib - The Telegram client API. It supports both bot and normal Telegram account. And it has many features not available in BOT API.
https://github.com/tdlib/td
There is an example of creating a Userbot on this github page: UserBot
There is also a library for managing a telegram account, which is used to create cross-platform telegram clients: TDLib

How to create an azure chat bot which can send chat messages without any user input

I have tried developing azure bots before. Currently I am trying to find out whether there is any way we could set up a bot that can constantly monitor something and send messages to particular users without user initiating a chat.
For instance, a bot monitors a system and find something wrong and sends a chat message to the user ( Bot initiates the chat in this case ). I did some research but couldn't find any way to achieve this yet.
Thanks in advance,
DM
This concept is called Proactive Messaging in the Bot Framework. There are some example in C# here: https://github.com/Microsoft/BotBuilder-Samples/tree/master/CSharp/core-proactiveMessages and node.js here: https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-proactiveMessages
Something to note is that different channels have different restrictions on when a proactive message can be sent to a user. For instance, on Facebook you have a 24 hour window from the time the user messaged the bot. After 24 hours, if the user has not messaged the bot, then proactive messages will not be allowed through.
More information can be found in this doc: https://learn.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-proactive-messages
Edit:
You can also create a Functions Bot in Azure using the Proactive template and it will create a bot that has BasicProactiveEchoDialog.csx that demonstrates how to en-queue a CloudQueueMessage into a CloudStorageAccount. The template will also create an Azure Function that is triggered by additions to the queue. When the function is triggered, it will send the queued message to the user on the channel.

How to receive bot's messages in telegram?

I wrote some bot that sends messages to some channel using nodejs. This bot is an admin in that channel and it can see messages from users using /getupdates api. However it can't see own messages. Is there any way to do that?

Resources