0

when member in telegram group has already sent a photo in to telegram group , now he edits the image and updates caption text with EDIT option in telegram , the new updated caption he made is needed in google sheets.

Now already using below for Caption which is working fine, but when the image is EDITED its not capturing

var data = JSON.parse(e.postData.contents);
var caption = data.message.caption ;
 SpreadsheetApp.openById(ssId).getSheets()[0].appendRow([new Date(),caption ]);
vector
  • 1,032
  • 1
  • 4
  • 16

1 Answers1

0

Try changing this to :-

var caption = data.message.caption

this :-

var caption = data.edited_message.caption
vector
  • 1,032
  • 1
  • 4
  • 16
  • Hi Vector... tried the solution provide but not working – Nitya Priya Feb 14 '22 at 09:44
  • What error you're getting, or did you tried checking what JSON response you're getting back from bot, because i just checked it with test bot and it is working absolutely fine. – vector Feb 14 '22 at 09:56
  • Thanks for your time and response Vector... I just replace my Var Caption = with what you have mentioned in my current working script. After replacing if any message or photo sent to my telegram group, no new records are created in my google sheets. If i revert back to my old caption , then records are created on any activity in telegram group – Nitya Priya Feb 14 '22 at 11:46
  • create a test sheet in spreadsheet, and try to append this `JSON.parse(e.postData.contents)` using `appendRow()` method and see what JSON response you're getting when user is editing something in telegram bot. – vector Feb 14 '22 at 11:52
  • ok @Vector i will try and update – Nitya Priya Feb 16 '22 at 03:41