B4J Code Snippet sendPhoto with telegram

Can't try it with httpjob, so use curl instead, because raspberry pi/linux can also use this command

B4X:
    Dim url As String = $"https://api.telegram.org/bot${pToken}/sendPhoto"$  
    Dim shl As Shell
    shl.Initialize("TeleImage", "curl.exe", Array As String(url,"-F",$"chat_id=${chatid}"$,"-F",$"photo=@${imgDir}\${imgName}"$))
    shl.WorkingDirectory = File.DirApp
    shl.Run(-1)
 
Last edited:

jinyistudio

Well-Known Member
Licensed User
Longtime User
It is ok but It cann't send local disk image file.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…