N
N
novnovember242017-10-22 19:29:49
PHP
novnovember24, 2017-10-22 19:29:49

How to create a telegram bot that would take information from an xml file and send data to the mail?

...the task is complicated by the fact that I only know html, css, and some js. In the plans - php and in general everything that a full-stack developer may need, because I plan to develop in this direction.
Now the task is: you need to create a bot in telegrams (it already exists, it was easy); it needs to take data about the product from the xml file, when the user wants to know which product is sold in general, and which one is available - in particular; you need the bot to send user data (name, contact phone number) to the mail.
I would like to know with the help of what technologies this can be implemented in principle, and in what way.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
nllm, 2017-10-22
@nllm

Write everything in the same language in which the bot was made.
If you know js and you are interested in working with it, then look towards nodejs and develop in this direction.
On js, you can work with xml (the first task), and send it to the mail (the second task).
And so everything can be solved in any language that you can run on the server with your bot.

D
Dimonchik, 2017-10-22
@dimonchik2013

Python + Proger

K
Kirill Gorelov, 2017-10-23
@Kirill-Gorelov

I don't know yet how to implement it more precisely, but.
I have my own bot that sends me emails. But it is launched from the browser (I needed it that way).
You can customize it to suit your needs and I'm sure it will work.
Here is the function that sends me emails. It can be easily rewritten.

<?php
  function regHandler($cert, $token, $murl) 
  {
$url = "https://api.telegram.org/bot" . $token . "/setWebhook";

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, "url=".$murl."&[email protected]".realpath($cert));
    $out = curl_exec($curl);
    // echo $out;
    curl_close($curl);
echo "<pre>";
     	print_r($out);
 echo "</pre>";


  }

  $token = 'токен';
  $path = 'секретный ключ' ssl сертификата; 
  $handlerurl = 'Адрес сайта от куда запускается бот'; // ИЗМЕНИТЕ ССЫЛКУ
  
  regHandler($path, $token, $handlerurl);
?>

If I were you, I would steer clear of this. And be sure to https://core.telegram.org/bots/api - documentation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question