@dias978
работник

Ошибка Script Bot Гугул таблица?

let token = "5771138121:AAH-DqgYkkXlvO3Zg014u1TBpdLEZiUv4EU";

function getMe() {
let response = UrlFetchApp.fetch("https://api.telegram.org/bot" + token + "/getMe");
console.log(response.getContentText());
}

function setWebhook() {
let webAppUrl = "https://script.google.com/macros/s/AKfycbyHFFWQUth...";
let response = UrlFetchApp.fetch("https://api.telegram.org/bot" + token + "/setWebhook?url=" + webAppUrl);
console.log(response.getContentText());
}

function sendText(chat_id, text) {
let data = {
method: "post",
payload: {
method: "sendMessage",
chat_id: String(chat_id),
text: text,
parse_mode: "HTML"
}
};
UrlFetchApp.fetch('https://api.telegram.org/bot' + token + '/', data);
}

function send() {
let chat_id =5658351532;
let text = "Привет! Как дела?";
sendText(chat_id, text);
}

function doPost(e) {
let contents = JSON.parse(e.postData.contents);
let chat_id = contents.message.chat.id;
let text = contents.message.text;
sendText(chat_id, text);
SpreadsheetApp.openById("1waKoiNp2cITZGUZ4D1-9s8AzWU-0RrFYkRh0gtaR5BU").getSheetByName("Messages").appendRow([chat_id, text]);
}
_____________________________________________________________________________________________________

ОШИБКА
Exception: Request failed for https://api.telegram.org returned code 400. Truncated server response: {"ok":false,"error_code":400,"description":"Bad Request: chat not found"} (use muteHttpExceptions option to examine full response)
sendText @ Код.gs:24
send @ Код.gs:30
  • Вопрос задан
  • 358 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы