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"));`

  • 3
  • 2
  • 2208
  • twitter facebook

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.

  • 1

From this API Spec https://developers.line.me/en/docs/messaging-api/reference/#get-content it will returns the content of the message in binary format.

I hope this helps you.

  • 0
本当によろしいですか? question.vm