Git Product home page Git Product logo

telegram-http-echo-bot's Introduction

Telegram HTTP echo bot

This bot allows broadcasting HTTP requests sent to a little web service to Telegram conversations. It can be used as an echo service for your applications to send notices to subscribed users through Telegram.

Quick start

  1. Install dependencies
npm install
  1. Copy config.json.tmpl to config.json
cp config.json.tmpl config.json
  1. Add your BotFather token to config.json.
  2. Run the application:
npm run-script serve

This will run the HTTP server on port 3030.

  1. Register some topics on the server
curl -X POST \
  http://localhost:3030/topic \
  -H 'accept: application/json' \
  -H 'content-type: application/json' \
  -d '{
	"topic": "sports"
}'
curl -X POST \
  http://localhost:3030/topic \
  -H 'accept: application/json' \
  -H 'content-type: application/json' \
  -d '{
	"topic": "technology"
}'
  1. Add the bot to a Telegram chat
  2. Subscribe to some topics with /subscribe :topic, e.g. /subscribe sports

Subscribe to topic

  1. Send messages to subscribed chats:
curl -X POST \
  http://localhost:3030/broadcast \
  -H 'accept: application/json' \
  -H 'content-type: application/json' \
  -d '{
	"topic": "sports",
	"message": {
		"Title": "Gareth Southgate has paid tribute to former team-mate Ugo Ehiogu",
		"Summary": "England manager Gareth Southgate has paid tribute to Ugo Ehiogu and spoken of the *true partnership* he shared with his former Aston Villa and Middlesbrough team-mate.",
		"Read more": "http://www.skysports.com/football/news/11095/10845530/gareth-southgate-has-paid-tribute-to-former-team-mate-ugo-ehiogu"
	}
}'

Broadcasting message to Telegram

telegram-http-echo-bot's People

Contributors

fer2d2 avatar

Stargazers

finderfail avatar Ángel González avatar

Watchers

James Cloos avatar  avatar

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.