Saturday, November 4, 2017

Connect Telegram Bot to Google Spreadshee (Google Apps Script)

Connect Telegram Bot to Google Spreadsheet (Google Apps Script) Full script below: 





// FOLLOW THE INSTRUCTIONS IN THIS TUTORIAL
// How to connect your Telegram Bot to a Google Spreadsheet (Google Apps Script)
// https://www.youtube.com/watch?v=mKSXd... 
// 
// FILL IN THE GLOBAL VARIABLES token, webAppUrl and ssId 
// 

var token = ""; // FILL IN YOUR OWN TOKEN 
var telegramUrl = "https://api.telegram.org/bot" + token; 
var webAppUrl = ""; // FILL IN YOUR GOOGLE WEB APP ADDRESS 
var ssId = ""; // FILL IN THE ID OF YOUR SPREADSHEET 

function getMe() { 
var url = telegramUrl + "/getMe"; 
var response = UrlFetchApp.fetch(url); 
Logger.log(response.getContentText()); 


function setWebhook() { 
var url = telegramUrl + "/setWebhook?url=" + webAppUrl; 
var response = UrlFetchApp.fetch(url); 
Logger.log(response.getContentText()); 


function sendText(id,text) { 
var url = telegramUrl + "/sendMessage?chat_id=" + id + "&text=" + text; 
var response = UrlFetchApp.fetch(url); 
Logger.log(response.getContentText()); 


function doGet(e) { return HtmlService.createHtmlOutput("Hi there"); 


function doPost(e) { 
// this is where telegram works 
var data = JSON.parse(e.postData.contents); 
var text = data.message.text; 
var id = data.message.chat.id; 
var name = data.message.chat.first_name + " " + data.message.chat.last_name; 
var answer = "Hi " + name + ", thank you for your comment " + text; 
sendText(id,answer); 
SpreadsheetApp.openById(ssId).getSheets()[0].appendRow([new Date(),id,name,text,answer]); 

if(/^@/.test(text)) { 
var sheetName = text.slice(1).split(" ")[0]; 
var sheet = SpreadsheetApp.openById(ssId).getSheetByName(sheetName) ? SpreadsheetApp.openById(ssId).getSheetByName(sheetName) : SpreadsheetApp.openById(ssId).insertSheet(sheetName); 
var comment = text.split(" ").slice(1).join(" "); 
sheet.appendRow([new Date(),id,name,comment,answer]); 

}

MAXIT INTERNET

BLOGGER

CD DVD RW

DELL

DOWNLOAD

FTP Server Linux

HACK

HARD DRIVE

HOW TO WORKIN

HARDWAER

INTERNET

INTERNET CAFE

LAPTOP

LENOVO

LINUX

Additional configuration for Samba Server (Part 2)  

BSNL/Airtel/Idea using Huawei E156G 3g Wireless USB Linux 5   

Basic File Extensions    CHANGING AN ACCOUNT EXPIRATION DATE   

Configure Linux as a Router   

Configure SAMBA Server (Part-1)   

Configure VNC server   

Configure Yum Server (Part-1)   

Configure yum server for Client machine (Part 3)   

Configuring Samba as a Standalone Server (Part 3)  

Connecting ftp Server with Anonymous User Part 5  

Create ftp account with Shared directory Part 3  

DHCP Server Configuration Part 2  

DHCP Server Configuration Part-1  

DHCP Server Configuration Part-3  

Enabling FTP Services in Yum Server (Part 5)  

FTP Server Configuration Part 1  

FTP Server How to Change In Primary DNS Server Part 2  

HTTP Client side configuration (Part 4)  

How to Vsftpd conf files Parameter Part 6   

LINUX FILE SYSTEM STRUCTURE  

Linux User Administrtion  

Linux as a Router configuration for Client Machine   

Linux client machine FileZilla FTP Client Part 4  

Local Yum Server (Part 2)  

Modifying Existing User Information  

Primary DNS Server Configuration Part-1  

Primary DNS Server Configuration Part-2    

Primary DNS Server Configuration Part-3  

Remove Linux From Your Pc Safely and restoring your MBR  

Sharing & Accessing Samba Share (Part 4)   

Speeding up your internet connection under Linux and Windows   

THE ROOT FILE SYSTEM   

VNC Server Configuration

LINUX LAB

Linux as a Router

MOTHERBOARD

Mobile

NETWORKING

REDHAT 5

REGISTRY EDTOR

RESET BIOS PASSWORD

SAMBA Server Linux

SERVER

SERVER CONFIG

SOFTWAER

VNC server Linux

Window 10

Window XP