want to save chat id inside database(telegram bot) - node.js

total newbie in telegram bot. i want to make a telegram bot that can save chat id inside the database and send notification to them. How can i implement it. im using node.js to make the bot btw

Related

How to make that when you click on the text it was copied telegram bot api node.js

I am writing a telegram to the bot. I ran into such a problem. I need the bot to send a message (text) when clicked on which it was copied (as a token from #BotFather)
I use node.js

telegram bot auto leaving from channel

hi all i'm new to telegram apis and bot, i'm having some troubles with my bot: i setted it, got my token and it can become the admin of the channels i do need to admin with it. just the bot every now and then just leave the channel by itself when another administrator of the same channel in whitch it is in posts a message or invite a new user to the channel. does it make any sense to you? is there a solution to keep it in charge of the channel?
other infos: i program in php, the bot is needed to post messages in telegram via a web site programmed in php
i would apreciate a real answear and not just a paste of the link to telegram bot documentation
thanks a lot

Is it possible to have one Discord bot DM another bot?

I'm building out an automated test bot that is meant to test the commands of my main bot. Everything is working fine except that my test bot doesn't seem to be able to receive DMs from the main bot.
I'm currently using discord.js
message.author.send('test dm from one bot to another')
and getting the error:
DiscordAPIError: Cannot send messages to this user
Is there a setting for the bot, or a possible workaround so that I can test my bot's DM functionality?
Both bots can receive DMs from users just fine.
Currently, I don't think it is possible for a bot to send a DM to another bot.

sending direct messages from nodejs script to telegram

Is it possible to send a message from a node.js server to someone's mobile number or telegram Id directly?
is it possible without using a telegram bot?
I need an API like below:
function sendMessage(senderTelegramId, receiverTelegramId, messageText)
In short: No, without a bot no way for now.
Detailed explanation:
In order for you to send users messages on telegram you would need to create your own telegram bot. They have a well documented API which you can read and play around with.
There are 2 things you should know about sending messages to users using telegram bot:
You can't just send random people messages on telegram even if you know their phone number, to send them messages you need to have their chat_id. See how in the docs
To get the chat_id the user must first click the start button that comes up when they open your bot for the first time. Telegram will send you the chat id of that user and you save it for later when you would want to send messages to that user.
There are tons of libraries that makes working telegram bots very easy, it wouldn't take you more than an hour to get started.
I hope this answers the question, feel free to ask further questions, I have made some bots and you can also play around with them to see how it works.
Cheers )
There is actually one more easiest way to send a message to chat
just fetch the URL
https://api.telegram.org/bot[BOT_API_KEY]/sendMessage?chat_id=[MY_CHANNEL_NAME]&text=[MY_MESSAGE_TEXT]
you can find more details here
https://xabaras.medium.com/sending-a-message-to-a-telegram-channel-the-easy-way-eb0a0b32968

Is it possible for a Telegram Bot to send any type of message without users trigger?

So I need my Telegram bot to ask a question from user (send any message of any possible type) without any initiation from a user. Is it possible? I cant find anything about this.
If the user interacted with your bot before you just need to use their user_id and send your message. You can't however send message to a user who has never interacted with your bot.
Telegram BOT never can take an action before user interact with bot. because most of available method need "chat_id". if you dont have "chat_id", you can only run simple method like getMe, getUpdates,etc.

Resources