Code Monkey home page Code Monkey logo

mqtt2telegram's Introduction

MQTT 2 Telegram

logo

@Mqtt2TelegramBot bot allows you to add notification in your project in minutes with almost no coding. Within the bot you subscribe to a topic of your choice. The topic name reflects the type of the event of your interest (e.g. IoT sensor reading, CI/CD pipeline status, any regular job you need to report status of). After you subscribe to the topic by issuing a command /sub topic the bot generates a private API for you and returns a command you can use to start sending messages to yourself immediately.

Features

  • allows managing subscriptions with commands /sub, /list, /unsub
  • generates private REST API for sending messages, e.g. /sub test will return
http -a ${chatId}:${secret} https://mqtt2telegram.projects.royz.cc/api/v1.0/send topic=test payload='<your message>'

where chatId is your telegram ID, secret is generated by the bot.

  • allows sending images as a payload
http -a ${chatId}:${secret} --multipart https://mqtt2telegram.projects.royz.cc/api/v1.0/sendImage topic=images [email protected]

where image.jpeg is an image file located in the current directory.

Implementation details

The bot uses MQTT under the hood, when you subscribe to a topic it subscribes to ${chatId}/${topic} in MQTT thus allowing users to have their own set of topics. It is possible to fork the repo and deploy it with your own MQTT broker, in this case you will be able to send notifications directly to MQTT.

This is how you can send messages directly to MQTT given you have your own deployment:

Text message

mqtt pub -h ${MQTT_HOST} -p 8883 -s -u ${MQTT_USER} --password ${MQTT_PASSWORD} -t "${chatId}/${topic}" -m 'Hello world'

Image

mqtt pub -h ${MQTT_HOST} -p 8883 -s -u ${MQTT_USER} --password ${MQTT_PASSWORD} -t "${chatId}/${topic}" -m:file ~/tmp/img.jpeg -ct 'image:img.jpeg'

Stack

  • guice
  • javalin
  • telegramBots
  • java mongo driver & atlas cloud

REST API Authentication

Basic authorization of telegramId:secret

Libraries

mqtt2telegram's People

Contributors

zjor avatar

Stargazers

 avatar Imaginary Stargazer avatar  avatar theGrove avatar  avatar Sergey Lazchenko avatar  avatar  avatar Christian W. avatar  avatar

Watchers

 avatar  avatar

Forkers

00xvil00

mqtt2telegram's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.