southbridgeio / redmine_bots

44 stars 11 forks source link

Build Status Rate at redmine.org

redmine_bots

This plugin provides common stuff to build redmine plugins that involve Slack/Telegram API usage.

Requirements

Upgrade from 0.2.0 to 0.3+

From 0.3.0 proxy settings are unified for tdlib and bot and there is support for multiple proxies. If you have used proxies before, you should reassign it on plugin settings page.

Upgrade from 0.1.0 to 0.2+

Webhook URL is changed in 0.2.0 because of webhook secret. You need to reinitialize webhook from plugin settings page.

Telegram

Telegram support includes:

Tdlib

In order to use tdlib client you need compiled TDLib.

It should be placed it in redmine_root/vendor or added to ldconfig.

For CentOS you can use our repositories:

http://rpms.southbridge.ru/rhel7/stable/x86_64/

http://rpms.southbridge.ru/rhel6/stable/x86_64/

And also SRPMS:

http://rpms.southbridge.ru/rhel7/stable/SRPMS/

http://rpms.southbridge.ru/rhel6/stable/SRPMS/

To make telegram client working you should follow steps:

IMPORTANT: 2FA is not supported at the moment

Bot API

It is necessary to register a bot and get its token. There is a @BotFather bot used in Telegram for this purpose. Type /start to get a complete list of available commands.

Type /newbot command to register a new bot. @BotFather will ask you to name the new bot. The bot's name must end with the "bot" word. On success @BotFather will give you a token for your new bot and a link so you could quickly add the bot to the contact list. You'll have to come up with a new name if registration fails.

Set the Privacy mode to disabled with /setprivacy. This will let the bot listen to all group chats and write its logs to Redmine chat archive.

Set bot domain with /setdomain for account connection via Telegram Login. Otherwise, you will receive Bot domain invalid error on account connection page.

Enter the bot's token on the Plugin Settings page to add the bot to your chat.

To add hints for commands for the bot, use command /setcommands. You need to send list of commands with descriptions. You can get this list from command /help.

Bot should be added to contacts of account used to authorize telegram client in plugin.

Bot can work in two modes — getUpdates or WebHooks.

getUpdates

To work via getUpdates, you should run bot process bundle exec rake redmine_bots:telegram. This will drop bot WebHook setting.

WebHooks

To work via WebHooks, you should go to plugin settings and press button "Initialize bot" (bot token should be saved earlier, and notice that redmine should work on https)

Slack

Slack support includes:

In order to use Slack integrations you need to follow these steps:

Migration from redmine_telegram_common

You can transparently migrate your old data (telegram accounts, settings and tdlib db/files) to new DB structure if you used redmine_telegram_common before with bundle exec rake redmine_bots:migrate_from_telegram_common.

Author of the Plugin

The plugin is designed by Southbridge