REST API server written in Go. Supports basic HTTP auth.
- Rename api.env.template to api.env and add correct its contents, such as Telegram BOT token, basic auth credential, etc.
- Run
docker-compose up -dto start the server
Simple key-value file which will be used by docker to set container environment variables.
-
PORTmandatory port to use for service. -
TELEGRAM_BOT_TOKENmandatory telegram bot token. -
TELEGRAM_DEFAULT_CHAT_IDdefault telegram chat ID, which will receive messages from the bot. This parameter is optinal. -
API_V1_CREDSusername/password pairs in JSON format of users who are allowed to access API:{"username1":"password1", "username2":"password2"}. This parameter is optional.
API to send messages.
-
/api/v1/telegram/messages/sendPOST method which passes message to telegram. It accepts JSON in the following format:{ "message": "message to send", "chat_id": 1234567890, "silent": true }where
chat_idis telegram chat id andsilentis a flag indicating if message should be sent silently