Logic Machine Forum
Telegram Image - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Telegram Image (/showthread.php?tid=2506)



Telegram Image - adiaz - 09.03.2020

Hello,

I have this function created to send image with Telegram's BOT.

local telegram_url_sendphototo = 'https://api.telegram.org/BOT/sendPhoto?'


function TelegramPhoto(photo)
   local data_str = 'chat_id=' .. chat_id .. '&photo=' .. photo ..''
   local res, code, headers, status = ssl.https.request(telegram_url_sendphototo,data_str)
   log (res,code,headers,status)
end


I try to send LogicMachine Icon Image but it gives me an error.

--TelegramPhoto("http://logicmachineurl:port/scada/resources/icons/door.png")

If I take an image URL from google images there is no problem..

Is posible to get image from LogicMachine icons?

Thanks


RE: Telegram Image - admin - 09.03.2020

This won't work because LM web server cannot be reached from the outside. You need to send image using multipart/form-data request (https://core.telegram.org/bots/api#inputfile). See this thread for an example that can be used: https://forum.logicmachine.net/showthread.php?tid=734&pid=7150#pid7150