Discord - Post API Data via Bot - http

I want to create a Discord Bot which listens to an API Call from a different Server.
For Example:
Discord Bot is running in my own Server and listening to ! commands
Another Server (Webserver) is having an event
The other server needs to call my Discord Bot (HTTP Request ?)
The Discord Bot needs to send a Message containing the Data from the previous call to a predefined Channel
I just can't find a way to do this. I tried webhooks, bot commands, discord gateway etc.
But there just seems to be no way that I can be able to send a message to my discord server via bot from a http request.
Anyone having a great idea how to achieve this ?
Thanks in advance!
What I have done so far:
Created a Bot using discord.io
Created Bot commands listening to ! (works)
Created a Websocket (works, but not able to send message)
Created a Webhook via Discord.js (Works but created no URL so I can't send a Message, also too dynamic)

Related

http endpoint for webhook

good afternoon. I need to create http endpoint to which the webhook will be sent. I need to see what data will be in the webhook.
Please tell me the simple way to create an endpoint on my PC (Windows) with which I can send a webhook like this.
maybe there is some simple implementation on node.js or with using IIS.

Problems with Telegram Alert Channel Configuration in Grafana

I configured a Telegram bot and group according to the many tutorials one can find in the web.
I know the Telegram API token and the channel ID from ....telegram.../getUpdates. I am able to send messages via browser and via CURL using the URL:
https://api.telegram.org/bot5147154720:<etc, etc>/sendMessage?text=Hello2%20From%20Bot&chat_id=#<my_chat_name>
However, when I use these settings in Grafana (V8.2), I cannot send messages via the Telegram channel. I always get "Failed to send" errors. Are there settings one has to make to the Grafana server configuration or something else?

Telegram get messages history

Telegram In Dart or http request
How to get group all messages by using dart or http
Note that I have my bot token and I wanna use it in dart ("No another Languages") or http
Currently you can't get old messages from a group with the Bots API.
You can save every message in a database for a later use, but old messages are not accessible. The only way is by using the client API.

What is the web request to send a message to my telegram bot?

I tried this:
https://api.telegram.org/botXXtokenxx/sendMessage?chat_id=chat_id&text=text
But this is to send a message from the bot.
But what I need to do to send to the bot? (not from the bot)
You can either use a regular Telegram client (Telegram, Telegram X, Telegram Desktop, etc) to do it manually, or if you need an API (for whatever reason)...
You need the client API.
https://core.telegram.org/#getting-started
Once you have an API key for the client API and all that, you can send messages as explained here.
https://core.telegram.org/method/messages.sendMessage
Note that a human should be triggering this, as Telegram encourages (may be against ToS?) using a bot API for programatic access rather than the client API.

How can i trigger a Telegram Bot via an API user

i've set up a working telegram bot that get's triggered on a /mission command. I want to use the bot within groups to enable a fast response feedback system for my organization. the flow is like follows:
1) a API client (no bot, just pure api) sends a message to a group, triggering the bot using /mission .
2) the bot responds to the command and the feedback process starts..
As a normal user, I can trigger the bot whereas the api user won't even reach my bot using webhooks.
Is there any known limitation on what APIs can trigger?
thanks!
Telegram MTProto API has same limits and same benefits of a normal Telegram user. So, you can trigger all bots you want, but be careful with FLOOD_WAIT error: an user sends too much messages in one second or in one minute, Telegram blocks the user for x seconds.
If you don't want to setup tg-cli, and other stuff to run MTProto client on your server and control it, I suggest you to use PWRTelegram APIs, so logging in as user.

Resources