I created a web service that returns the base64 of charts. I need to get it and show it inside of a card in hangout chatbot. But the only whay that I found was save in google drive.
There is a way to do that without save the file?
Javascript code:
function getbase64(base64){ //Function that I used to save in Google Drive
currentFolder = DriveApp.getFolderById("id-folder");
blob = Utilities.newBlob(Utilities.base64Decode(base64),'image/png').setName("teste.png")
currentFolder.createFile(blob);
}
function card(x){ //Function that returns a card
return {
"cards": [{
"sections": [{
"widgets": [ {
"image": { "imageUrl":x}},{
"buttons": [{
"textButton": {
"text": "Open Image",
"onClick": {
"openLink": {
"url": x}}}}]}]}]}]}}
function onMessage(e) { //Function that I used to try show base64 in a card without save in google drive
if(e.message.text == 'chart') {
var base64data = 'data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAAlgAAAOECAYAAA=='
return card(base64data)
}
}