Skip to main content
Solved

How to store image in inbound message to google drive

  • 8 July 2024
  • 2 replies
  • 142 views

Hey my goal is to save the attachment in the inbound message and save it in my google drive.

When I am using the link “https://api2.frontapp.com/download/fil_2lrutl53”, it’s giving error: 

{"_error":{"status":401,"title":"Unauthenticated","message":"JSON Web Token error"}}

To solve this I am using this API endpoint:

https://dev.frontapp.com/reference/download-attachment
 

I am getting below response:

 

 

Is there anything I am doing incorrectly.

 

Also if there is any other alternate approach to achieve my goal please do let me know.

 

Thanks

2 replies

Badge +1

How to store image OR any sort of attachement in inbound message to google drive ?
 

Userlevel 4
Badge +8

Hi @abdur_siddiqui , You’re receiving a 401 unauthorized response because your request does not pass your API token to authenticate the request.

To resolve, just create an API token at https://app.frontapp.com/settings/developers/tokens, then replace the <Token> on line 7 of your example code with the value of your new API token. 

If you are passing a real token in your code, it may be the case that the API token being used does not have the appropriate token scopes to access this resource. 

Additionally, in your example code, you probably don’t want to send the Accept: “application/json” header unless you know you’re downloading an attachment which is a .json file. 

As for storing the files in Google Drive, you will need to perform a second API call with a Google Drive SDK to send the file to Google Drive after downloading it.

Reply