带有Google Apps脚本的电报API [英] Telegram API with Google Apps Script

查看:101
本文介绍了带有Google Apps脚本的电报API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在搜索与Google Apps脚本一起使用的电报API 的示例可以帮助我学习如何使用此API,例如向特定用户发送消息

I'm searching an example of Telegram API usage with Google Apps Script, or anyone/anything that can help me to learn how to use this API, for instance to send a message to a certain user

推荐答案

我正在寻找类似的东西,但找不到任何东西,所以我做了我自己的东西,我会在这里写下来,也许有人会利用它.

I was searching for something similar, and couldn't find any, so I have made my own, I will write it down here perhaps someone would make use of it.

这是可行的简单概念证明:

This is a simple proof of concept that works:

function sendTelegramNotification(botSecret, chatId, body) {
var response = UrlFetchApp.fetch("https://api.telegram.org/bot" + botSecret + "/sendMessage?text=" + encodeURIComponent(body) + "&chat_id=" + chatId + "&parse_mode=HTML");
}

其他命令可以用相同的方式进行.

Other commands can be made same way.

这篇关于带有Google Apps脚本的电报API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆