- Telegraf - Telegram Bot framework for Nodejs.
- request-promise - The simplified HTTP request client 'request' with Promise support. Powered by Bluebird.
- Winston - A logger for just about everything.
- Mocha - The fun, simple, flexible JavaScript test framework.
- Chai - Assertion library for Node.
- Nock - HTTP server mocking and expectations library for Node.
/help
- Prints this list/hello
- Say hello!/status
- Prints Portainer instance status/get_containers
- Prints list of containers and status/start_container
- Displays inline keyboard with containers to start if any/stop_container
- Displays inline keyboard with containers to stop if any
Portainer:
PORTAINER_HOST
= Hostname/IP used by Portainer instance. Default value is 'testhost'PORTAINER_PORT
= Port number used by Portainer instance. Default value is '9000'PORTAINER_USER
= Username used to log in Portainer instance. Default value is 'admin'PORTAINER_PASSWORD
= Password of Portainer user configured. Default value is 'adminpassword'PORTAINER_ENDPOINT
= Endpoint ID to manage. Default value is '1'
Telegram:
BOT_TOKEN
= Telegram Bot token provided by @BotFatherTELEGRAM_USERS
= List of Telegram users authorized to use the application. Default value is ''
Clone this repository:
$: git clone https://github.com/ruben-rodriguez/portainer-telegram-bot
Install dependencies:
$: npm install
Run test cases (no need to set any ENV variable):
$: npm test
Clone this repository:
$: git clone https://github.com/ruben-rodriguez/portainer-telegram-bot
Install dependencies:
$: npm install
Run (Don't forget to set ENV variables appropriately):
$: npm start
Clone this repository:
$: git clone https://github.com/ruben-rodriguez/portainer-telegram-bot
Leverage docker-build.sh
tool. Follows example usage:
$: sudo ./scripts/docker-build.sh "-e PORTAINER_HOST=127.0.0.1 -e BOT_TOKEN=xxxxxxxxx:qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq -e TELEGRAM_USERS=TelegramUser,TelegramUser2"
Note: sudo is required to execute Docker commands used by the script. Reading of the script before executing is encouraged!