How to get user photo in Nodejs using Graph API?

Copper Contributor

I am using following API to get users profile picture 
profilephoto_get

After looking at response I see something like follows 

����JFIF``��C  $.' ",#(7),01444'9=82<.342��C

2!!2222222222222222222222222222222222222222222222
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������������������������
���w!1AQaq"2�B���� #3R�br� 

now I am trying to use Data URI format to display this image in adaptive cards. So I am using following code to convert that to base45

Type 1: let base64Img = Buffer.from('above-data').toString('base64')

Type 2: let base64Image = new Buffer('above-data', 'binary').toString('base64');

Type 3: Using NPM Btoa module

var b64 = btoa('above-data');

 

None of ways I tried are working. As in if I put output in correct URI scheme to online converter it doesn't parse back to the image.

Please suggest where I might be going wrong ? Is there any chance I am not consuming API response correctly ?





 

0 Replies