Pushy is a combination of REST API and receivers that allows you to send push notifications to multiple chats or users (feeds) via simple HTTP requests. Here follows the quickstart guide with examples of things Pushy can do. Enjoy and be sure to navigate embedded links for advanced details.
Quickstart
Upon feed creation (e.g. in Telegram Bot) you will receive an API key. This API key is passed to the most of the API methods as api_key
parameter.
You can save it as an environment variable for the below examples to work:
export API_KEY=ak000000000000000000 # Replace with API key obtained before
Basic usage is as simple as subscribing to the feed and checking it out by sending a POST /v1/feeds/{api_key}/text
request with the api_key
which you got before and a notification text passed as request body.
You can try it out using curl
:
curl -X POST \
"https://api.pushy.tg/v1/feeds/$API_KEY/text" \
-d 'Hello, world!'
The notification with text Hello, world!
will be sent to all subscribers of the feed.
Editing
The command above will return a unique post_key
, which you can use to edit existing notifications. Be sure to save it along with the API key.
export EDIT_KEY=pk000000000000000000 # Replace with post key obtained before
Now all you need is to substitute this key into edit_key
parameter of PUT /v1/feeds/{api_key}/text/{edit_key}
request:
curl -X PUT \
"https://api.pushy.tg/v1/feeds/$API_KEY/text/$EDIT_KEY" \
-d 'Hello, Pushy!'
Tags
You can add some tags to the notifications you send. This may be done via tags
parameter of the above requests:
curl -X POST \
"https://api.pushy.tg/v1/feeds/$API_KEY/text?tags=hello,world" \
-d 'Hello, world!'
Find out more about this feature in the dedicated section of the documentation.
Media
Sending of media attachments of some formats are also supported.
It is possible to send media by its URL:
curl -X POST \
"https://api.pushy.tg/v1/feeds/$API_KEY/text?media_url=docs.pushy.tg/img/logo.png" \
-d 'Here goes the logo!'
Alternatively, the media can be uploaded directly:
curl -X POST \
"https://api.pushy.tg/v1/feeds/$API_KEY/media?media_type=image&media_caption=And+here+too!" \
--data-binary '@logo.png'
Any other details about supported media formats can be found in the dedicated section.