TL;DR

There is Telegram Uploader plugin for Jenkins CI which let you upload build artifacts to Telegram.

What's it for?

For example, with this plugin you could automate Android builds uploading to beta-testers Telegram chats directly accessed from mobile devices.

Installation

Download plugin hpi package and install it using Jenkins plugins manager (Manage Jenkins->Manage Plugins->Advanced->Upload Plugin).

Warning: this plugin needs Java 1.8.

Setup

Configure bot token in Jenkins system settings (Manage Jenkins->Configure System->Telegram Uploader):

Telegram Uploader Global Config

Add a "Upload artifacts to Telegram" post-build action to your Jenkins job after "Archive the artifacts" post-build action:

Telegram Uploader Job Config

Parameters:

  • Chat ID - positive integer value for private chats, negative integer value for groups or string like @channelname for channels.
  • Caption - uploaded artifact caption, 0-200 characters (including expanded environment variables).
  • Filter - Ant-style glob to use as filter for the artifact names to upload. Empty value disables filtering.
  • Disable notification - send the artifacts silently. If set, users will receive a notification with no sound.
  • Fail build if upload is failed - if set, mark build as failed if the artifact can't be uploaded by some reason, otherwise just issue warning in build console.

Gotchas

  • Plugin is still in alpha stage. Please report problems using GitHub Issues.
  • Sadly I don't know a simple way to obtain Telegram chat ID. You could write something to the bot and then check the id field in output of curl -i -X GET https://api.telegram.org/bot<inser_token_here>/getUpdates command.
  • Plugin uses Telegram Bot API which (at this moment) limits uploaded file size to 50 MB.
  • Links in Caption field are non-clickable on Android devices.

That's all, folks!