how to send alert picture attach email to telegram bot

Viewed 31

I can send an alert to telegram bot, but I can't see the attached image graph eg:uri/graph on telegram. how to i solve it ?

when i get the warning only the url does not include the photo; my example code:

def notify(GROUP_ID, context):
    send_text = 'https://api.telegram.org/bot' +TOKEN+ '/sendMessage?chat_id='+GROUP_ID+'&parse_mode=Markdown&text='+context
    response = requests.get(send_text)
    return response.json()
    

def get_decoded_email_body(msg):
    text = ""
    p = Parser()
    message = p.parsestr(msg.as_string())
    for part in message.walk():
      if part.get_content_type() == 'text/plain':
        charset = part.get_content_charset()
        if charset == None:
          text += unicode(part.get_payload(decode=True), 'utf8', 'ignore')
        else:
          text += unicode(part.get_payload(decode=True), str(charset), 'ignore')
    if type(text) != type(u""):
        text = unicode(text, 'utf8')
    return text
0 Answers
Related