Telegram Bot - can't send file from Google Drive

(Kiko App) #1

Hello!
I have a flow for Telegram bot with three functions:

  1. we wait when user send a message with data
  2. we create a new file on Google Drive with with this data
  3. we send this file from Google Drive to a user

I’m get error when try to send a file from Google Drive, but a file is succesful created on Drive and a file_id is correct:

"Bad Request: wrong remote file identifier specified: Wrong string length"

How to fix it?

(Nathan Stults) #2

Hello,

Adding a document to Google Drive returns a File ID from Google that is not at all related to Telegram, so you can’t try to send the document via Telegram via the File ID.

You could try to send it via a URL, but you’d need to construct the URL for Google drive from the ID that was output, and I’m still not sure it will work because I doubt Telegram can download the file unless it is public.

I’m not sure there’s a good way to do what you’re looking to do, but you could potentially send the user just a text message with the URL: https://drive.google.com/file/d/{YOUR FILE ID FROM THE ADD A DOCUMENT TASK}/view?usp=drive_link

1 Like