title: Is there any ways to send a canvas item by using telegram api?
body: <p>Is there any possible ways to get my canvas by blob and send it using telegram api directly? I tried to convert the canvas into a url but telegram still cannot send it.</p>
  <p>My system is about sending emergency message. When the alarm was triggered, the live graph will be send to a telegram group to notify the members. But what is troubling me is telegram only can send photo by using url or upload from local.</p>
  <p>Below is my code example:</p>
  <pre><code>exportTelegramPNG(){
  
        const bot = {
          TOKEN:&quot;telegram bot token&quot;,
          chatID:&quot;telegram bot chatID&quot;,
        }
  
        const filename = this.state.stationRecord[&quot;StationName&quot;]+'_'+this.state.currentDate;
        html2canvas(document.getElementById(this.chart2.current.chart.container.id)).then(function (canvas) {
        
        if (canvas) {
          canvas.toBlob(function (blob) {
            
            const newImg = document.createElement('img');
            const url = URL.createObjectURL(blob);
  
            newImg.onload = () =&gt; {
            // no longer need to read the blob so it's revoked
            URL.revokeObjectURL(url);
            };
  
            newImg.src = url;
            document.body.appendChild(newImg);
  
            fetch(`https://api.telegram.org/bot${bot.TOKEN}/sendPhoto?chat_id=${bot.chatID}&amp;photo=${newImg}`, {
              method:&quot;GET&quot;
              })
          });
          
        }
      });
    }
  </code></pre>
  <p>Here is the error log in console.</p>
  <pre><code>GET https://api.telegram.org/bot${bot.TOKEN}/sendPhoto?chat_id=${bot.chatID}&amp;photo=[object%20HTMLImageElement] 400
  </code></pre>
  <p>Thank you for anyone who gives suggestion and helps.</p>