Created
March 24, 2019 14:23
-
-
Save fnzip/65417af97a09f6089085a39a54c5e2bd to your computer and use it in GitHub Desktop.
Minimum System Telegram Bot With Google App Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
ubah variabel token dengan token bot kalian | |
simpan projek di Google App Script, lalu publish Dan pilih deploy as web app | |
ubah izin akses menjadi anyone, even anonymous lalu publish dan salin url nya | |
setWebhook bot telegram dengan url dari google tadi | |
jika ada pertanyaan silahkan kontak saya via telegram @alfian_oktafireza | |
*/ | |
var token = "12345678:abcdefgzzz"; | |
function doPost(e){ | |
var contents = JSON.parse(e.postData.contents); | |
var id = contents.message.from.id; | |
var text = contents.message.text; | |
// script berfungsi untuk mengirim kembali pesan yang anda kirim (hanya pesan) | |
UrlFetchApp.fetch("https://api.telegram.org/bot" + token + "/sendMessage?text_id=" + id + "&text=" text); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment