Answer the question
In order to leave comments, you need to log in
Can Telegram be used in conjunction with a Windows application?
Hello.
I design electronic devices for different applications. As a rule, they transmit data from sensors either to a personal computer under Windows or to a specialized application on the phone via Bluetooth. I would like to finalize the application on the computer, so that it also sends this data to the cart, if the Internet is available.
If I understand correctly, do I need to dig towards the telegram bot api? For the user to add this bot to himself.
But it's a little unclear to me if the bot is one, for all users. And there are dozens of users. How will the data come to those users who need it? I need an application on my computer to send data to a specific person. Or should I look at some other messenger? What do you advise?
Answer the question
In order to leave comments, you need to log in
To do this, it is enough to write one line.
TDownload.GetRequest('https://api.telegram.org/' + TG_BOT_TOKEN + '/sendMessage?chat_id=' + ChatId + '&text=' + TURLEncoding.URL.Encode(Text));
uses System.Net.HTTPClient;
function GetRequest(URL: string): Boolean;
var
HTTP: THTTPClient;
begin
Result := False;
if URL.IsEmpty then
Exit;
HTTP := THTTPClient.Create;
HTTP.HandleRedirects := True;
try
try
Result := HTTP.Get(URL).StatusCode = 200;
finally
HTTP.Free;
end;
except
Result := False;
end;
end;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question