Writes every message your Telegram bot receives to a Google Sheet as a row - the time, who sent it and exactly what they typed.

UsesGoogle SheetsTelegram

Log Telegram messages to a spreadsheet

TelegramTelegramWhen a new message is received. Save it as incomingMessage.When a new message is received. Save it as incomingMessage.
ValuesSet spreadsheetUrl to blank.Set spreadsheetUrl to blank.
ValuesSet sheetName to blank.Set sheetName to blank.
ValuesSet messageText to blank.Set messageText to blank.
Decisions & LoopsIf a step below fails, save the error as noTextErrorIf a step below fails, save the error as noTextError
Try
TextTrim incomingMessage.text and save it as messageText.Trim incomingMessage.text and save it as messageText.
On error
No steps
Decisions & LoopsIf messageText is emptyIf messageText is empty
Yes
Decisions & LoopsFinish the run: That message carried no text, so there was nothing to record.Finish the run: That message carried no text, so there was nothing to record.
No
No steps
ValuesSet senderName to blank.Set senderName to blank.
Decisions & LoopsIf a step below fails, save the error as noSenderErrorIf a step below fails, save the error as noSenderError
Try
TextTrim incomingMessage.from_username and save it as senderName.Trim incomingMessage.from_username and save it as senderName.
On error
No steps
Decisions & LoopsIf senderName is emptyIf senderName is empty
Yes
ValuesChange senderName to unknown.Change senderName to unknown.
No
No steps
ValuesSet senderId to incomingMessage.from_user_id.Set senderId to incomingMessage.from_user_id.
Decisions & LoopsIf senderId is nullIf senderId is null
Yes
ValuesChange senderId to blank.Change senderId to blank.
No
No steps
Dates & TimesGet the current date and time and save it as recordedAt.Get the current date and time and save it as recordedAt.
Google SheetsGoogle SheetsAdd a row to sheetName in spreadsheetUrl.Add a row to sheetName in spreadsheetUrl.