I am using the Google Chat card api to send a card back to a user to answer their questions. I wish to include an image within the results, however a direct URL cannot be provided since it is only exposed to the company network.
Instead I have attempted to do the following:
"image": {
"imageUrl": "data:image/png;base64, ... ",
"onClick": {
"openLink": {
"url": "https://example.com/"
}
}
}
However, I am receiving the following error message:
<HttpError 400 when requesting https://chat.googleapis.com/v1/spaces/XXXXXXXXXXX/messages?alt=json returned "Request contains an invalid argument.". Details: "Request contains an invalid argument.">
.
Is there any way I could send images using the Google Chat API that doesn't involve uploading the images to the public first, or am I doing something wrong with my implementation? The issue is not that the string is too long as the base 64 string that I am trying to send over is quite short.
The message is being sent from a python server, not from the online JavaScript based editor.
CodePudding user response:
It is currently not possible to include base64-encoded images instead of providing an imageURL within a Google Chat Card
A feature request to change this has already been filed on Google's Issue Tracker.
Currently this feature request is still under review and the best thing you can do is to "star" it to show that you are also interested in the implementation and thus increase visibility.
In the meantime, unfortunately there is no workaround to uploading and hosting the image.