I am working in Google Chat. I can post text all day long and would like to include a picture file. Google gives an example of an attachment using JSON, but I am looking for javascript to include a pic within the post.
var Body = '..'
// Pic file name in G Drive.
var Picture = DriveApp.getFilesByName('DMS.png');
// I know this needs to be JSON
const payload = JSON.stringify({ text: Body,
imgInput: Picture });
const options = {
method: 'POST',
contentType: 'application/json',
payload: payload,
};
UrlFetchApp.fetch(GOOGLE_CHAT_WEBHOOK_LINK, options);