Reputation: 5
So I needed something to act as a notifier and to connect it to my scripts, so I decided to try Telegram. I have successfully set up a Telegram bot. But I am having trouble in sending HTML formatted messages through the bot.
function wire(message) {
var token ='xxxxxxx';
var channel_id = 'xxxx'
var uid = 'https://api.telegram.org/bot'+token+'/sendMessage?chat_id='+channel_id+'&text='+message+'&parse_mode=HTML';
Logger.log(UrlFetchApp.fetch(uid));
}
function test() {
var body = "You were sent a message from <a href = http://www.example.com/profiles.php?XID=xxxxx>Batman</a> with the message:Hi";
var bish = encodeURIComponent(body);
wire(bish);
}
Running the function test gives me an error as:
{"ok":false,"error_code":400,"description":"Bad Request: can't parse entities: Unexpected end of name token at byte offset 40"}
What am I doing wrong here? Any input will be appreciated.
Upvotes: 0
Views: 1931