Up to this point I've managed to get it to work for a single argument (body) but without the second argument (photoUrl):
function SendTelegram(body,photoUrl) {
if (body.map) {
var response = body.map(function(b) {return SendTelegram(b);});
} else {
var response = UrlFetchApp.fetch(
"https://api.telegram.org/bot" + 'AAA' +
"/sendPhoto?caption=" + encodeURIComponent(body) +
"&photo=" + encodeURIComponent(photoUrl) +
"&chat_id=" + 'BBB' +
"&disable_web_page_preview=true&parse_mode=HTML"
);
}
}
I'm not able to understand how I should proceed to work with this two different arguments, for example, the function in the spreadsheet would be:
=ARRAYFORMULA(SendTelegram(A1:A,B1:B))
In my attempts when I try to add the second argument, it always uses the first row value in all calls, it doesn't follow the array one by one.