Question Details

How to Retreive Image from user

Dear all, I'm a java student programmer How can I retrieve the image from a user, I know that we use the code below to get the content the message content such as Image, Videos, or Audios. However, I do not see an example of how exactly we process the contents that the MessageContentResponse receive, I am confused about what is the type that the function returns, whether it's in JSON or in jpg directly, can anyone kindly explain to me what does the function retrieve and how do we process the retrieved result from the function, Thank you. The code that I found in the docs: `final LineMessagingClient client = LineMessagingClient .builder("<channel access token>") .build();

final MessageContentResponse messageContentResponse; try { messageContentResponse = client.getMessageContent("<messageId>").get(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); return; }

Files.copy(messageContentResponse.getStream(), Files.createTempFile("foo", "bar"));`

Edited: 1 years ago
Profile picture
Refo I. Akbar


Profile picture
Baptiste Jamin
Posted: 1 years ago

User information is not directly provided is the message content.

You must retrieve the userId, and then do a separeate request to fetch the user's profile. It will then let you to get the user's avatar, username, etc.

Profile picture
Prakash Divy
Posted: 1 years ago
Edited: 1 years ago

From this API Spec it will returns the content of the message in binary format.

I hope this helps you.

Are you sure? question.vm