D
D
Dmitry Gololobov2019-04-01 09:11:28
Node.js
Dmitry Gololobov, 2019-04-01 09:11:28

How to set up webhook in telegram bot?

I am writing a bot on telegraf.js There is a task, you need to give the user a message when a trigger works on a third-party server.
We decided to use web hooks for this.
The process will be built as follows:
A record is created on a third-party server, after that data is sent to the webhook address, and then the bot issues a message to the user.
This is where the question arises of how web hooks work in telegram bots.
I didn’t find a suitable example, I’m friends with English at the dictionary level, so I can’t read the manual normally.
Can someone tell me how this actually works.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kudis, 2019-04-01
@dGololobov

Everything can be made easier!
If the user connected to the bot by sending start, then you can directly knock on the bot if this is your site:

$botID = 'your_bot_id';

$url = 'https://api.telegram.org/bot' . $botID . '/sendMessage';

$message = 'стработал тригер!!!';

$arParams = [
    'disable_web_page_preview' => true,
    'chat_id' => 'user_id'
    'text' => $message,
    'parse_mode' => 'HTML',
];

or make a receiving script with a token where the observed site will knock!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question