curl - Telegram Bot that takes data from input form and sends it to a telegram group/user -


i want friend. has simple site made html, javascript , jquery. needs integrate site telegram so, if fills form on site, telegram bot should send information in group chat (i know how take chat_id, nothing more telegram bots).

so tried send post requests curl bot sendmessage method, seems didnt worked.

maybe made mistake command line curl, doesnt show me output when make request. i`ve found sends output in stdout (whatever is...)

so have 2 questions:
1: how can make curl show response output in command line?
2: how make request send message myself (in telegram bot manual says should below..)

curl -s \ -x post \ https://api.telegram.org/bot<token>/sendmessage \ -d text="a message bot" \ -d chat_id=65535 \ | jq . 

i assumed need write in cmd tried personal bot token , chat_id didnt work.

you can simple request make bot send message.

https://api.telegram.org/bot<token>/sendmessage?text=your message here&chat_id=65535 

below sample code can make use of.

function sendmessage(){    chat_id = document.getelementbyid("chatid").value;    token = document.getelementbyid("token").value;    message = document.getelementbyid("message").value;    $.get("https://api.telegram.org/bot"+token+"/sendmessage?text="+message+"&chat_id="+chat_id);    }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>    <input type="text" id="chatid" value="chat id"></br>  <input type="text" id="token" value="bot token"></br>  <input type="text" id="message" value="message"></br>  <button onclick=sendmessage()>send message</button>


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -