const baseApiUrl https api telegram org function _buildURL token name

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
const baseApiUrl = 'https://api.telegram.org';
function _buildURL(token, name, text) {
return `${baseApiUrl}/bot${token}/sendMessage?chat_id=${name}&text=${text}`;
}
function sendMessage(name, text) {
fetch(_buildURL(name, text))
.then(console.log)
.catch(console.log);
}