Giter Club home page Giter Club logo

pusher's Introduction

pusher

pusher is an api server based on fiber to handle telegram bot /sendMessage api

pusher is for personal usage, thus it can only serve one user

CI

Auto build docker image by GitHub Actions

Setup Docker

Quick Start

docker run -d --name pusher -p 3333:3333 \
	-e TG_TOKEN=<your_tg_bot_token> \
	-e CHAT_ID=<your_chat_id> \
	bipy/pusher:latest

Fully Featured

docker run -d --name pusher -p 3333:3333 \
	-e TG_TOKEN=<your_tg_bot_token> \
	-e CHAT_ID=<your_chat_id> \
	-e SERVER_HOST=0.0.0.0 \
	-e SERVER_PORT=3333 \
	-e SECURE_KEY=pAssw0rd \
	bipy/pusher:latest

Do Use Behind a Reverse Proxy with HTTPS

Environment

Name Value Description
TG_TOKEN string <your_tg_bot_token>
CHAT_ID int <your_chat_id>
SERVER_HOST string default "0.0.0.0"
SERVER_PORT int default 3333
SECURE_KEY string default "" (disabled)

API

You can use pusher by GET or POST method

GET

Param Value Description
text string your message
msg string same as text (valid only if text is empty)
preview default is empty (disable preview)
markdown default is empty (disable markdown)

POST

{
    "text": "your message",
    "preview": false,
    "markdown": false
}

Also support for louislam/uptime-kuma Webhook Notification

(Optional) Use SECURE_KEY

HTTP Header Value Description
Secure-Key string used for verification
  1. Set environment
  2. Add header for each request

Questions

Q: Why would I use pusher rather than the official api?

  1. Telegram official api is blocked in some area:

    you can use pusher as louislam/uptime-kuma webhook notification

  2. pusher will remember bot token and chat id for you, so you can simply push your message by a GET query:

    curl "https://example.com/pusher?text=hello%20world"

    or even simpler using HTTPie:

    http POST https://example.com/pusher text="hello world"
    

โ€‹

Q: Where is the release?

  1. Deploying with docker is recommended, plz refer bipy/pusher - DockerHub or build image by yourself

  2. Also, if you want to build and run cli in a shell or as a service:

    git clone https://github.com/bipy/pusher.git; cd pusher
    
    go build
    
    TG_TOKEN=<your_tg_bot_token> CHAT_ID=<your_chat_id> ./pusher

Thanks to

muety/webhook2telegram

License

MIT License

Copyright (c) 2021 bipy

pusher's People

Contributors

bipy avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

cnmars

pusher's Issues

Status 502 when message is too long

Log

[Warning] client is still in beta, API might change in the future!,
07:34:24 | 502 |  1.204s |      172.17.0.1 | POST    | /               ,
07:35:51 | 200 |  1.033s |      172.17.0.1 | POST    | /               ,

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.