Chanify is a safe and simple notification tools. This repository is command line tools for Chanify.
Chanify is a safe and simple notification tools. This repository is command line tools for Chanify.
English | 简体中文
Chanify is a safe and simple notification tools. For developers, system administrators, and everyone can push notifications with API.
Table of Contents
Features
Getting Started
InstallationPrecompiled binary
Docker
From source
UsageAs Sender Client
As Serverless node
As Serverful node
Add New Node
Send messageCommand Line
Python 3
Ruby
NodeJS
PHP
HTTP APISend Text
Send Link
Send Image
Send Audio
Send File
Send Actions
Configuration
SecuritySetting Registrable
Token Lifetime
Chrome Extension
Windows Client
Docker Compose
Lua API
Contributing
License
Chanify is include these features:
Download precompiled binary from here.
$ docker pull wizjin/chanify:latest$ git clone https://github.com/chanify/chanify.git
$ cd chanify
$ make installUse chanify to send message.
# Text message
$ chanify send --endpoint=http://: --token= --text=
# URL message
$ chanify send --endpoint=http://: --token= --link=
# Image message
$ chanify send --endpoint=http://: --token= --image=
# Audio message
$ chanify send --endpoint=http://: --token= --audio=
# File message
$ chanify send --endpoint=http://: --token= --file= --text=
# Action message
$ chanify send --endpoint=http://: --token= --text= --title= --action="|"
# Timeline message
$ chanify send --endpoint=http://: --token= --timeline.code= = = ...endpoint default value is https://api.chanify.net, and notification will send by default server.
If you have own node server, please set endpoint to your node server url.
Chanify run in stateless mode, no device token will be stored in node.
All device token will be stored in api.chanify.net.
Message will send to apple apns server by api.chanify.net.
Send message workflow:
Start => node server => api.chanify.net => Apple server => iOS client# Start chanify
$ chanify serve --host= --port= --secret= --name= --endpoint=http://:
# Docker
$ docker run -it wizjin/chanify:latest serve --secret= --name= --endpoint=http://:Chanify run in stateful mode, device token will be stored in node.
Message will send to apple apns server direct.
Send message workflow:
Start => node server => Apple server => iOS clientStart server
# Start chanify
$ chanify serve --host= --port= --name= --datapath=~/.chanify --endpoint=http://:
# Docker
$ docker run -it -v /my/data:/root/.chanify wizjin/chanify:latest serve --name= --endpoint=http://:Use MySQL as a backend
--dburl=mysql://:@tcp(:)/?charset=utf8mb4&parseTime=true&loc=LocalChanify will not create database.
http://:/) to add node.# Text message
$ curl --form-string "text=hello" "http://:/v1/sender/"
# Text file
$ cat message.txt | curl -H "Content-Type: text/plain" --data-binary @- "http://:/v1/sender/"from urllib import request, parse
data = parse.urlencode({ 'text': 'hello' }).encode()
req = request.Request("http://:/v1/sender/", data=data)
request.urlopen(req)require 'net/http'
uri = URI('http://:/v1/sender/')
res = Net::HTTP.post_form(uri, 'text' => 'hello')
puts res.bodyconst https = require('https')
const querystring = require('querystring');
const data = querystring.stringify({ text: 'hello' })
const options = {
hostname: ':',
port: 80,
path: '/v1/sender/',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length
}
}
var req = https.request(options, (res) => {
res.on('data', (d) => {
process.stdout.write(d);
});
});
req.write(data);
req.end();$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://:/v1/sender/',
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => [ 'text' => 'hello' ],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;http://:/v1/sender//http://:/v1/sender/Content-Type:
text/plain: Body is text messagemultipart/form-data: The block of data("text") is text messageapplication/x-www-form-urlencoded: text=application/json; charset=utf-8: The fields are optional{
"token": "",
"title": "",
"text": "",
"copy": "",
"autocopy": 1,
"sound": 1,
"priority": 10,
"interruptionlevel": 0,
"actions": [
"ActionName1|http:///",
"ActionName2|http:///",
...
],
"timeline": {
"code": "",
"timestamp": 1620000000000,
"items": {
"key1": "value1",
"key2": "value2",
...
}
}
}Additional params
| Key | Default | Description |
|---|---|---|
| title | None | The title for notification message. |
| copy | None | The copy text for text notification. |
| autocopy | 0 |
Enable autocopy text for text notification. |
| sound | 0 |
1 enable sound, otherwise disable sound. |
| priority | 10 |
10 normal, 5 lower level. |
| interruption-level | active |
Interruption level for timing of a notification. |
| actions | None | Actions list. |
| timeline | None | Timeline object. |
sound:
interruption-level:
active: Lights up screen and may play a sound.passive: Does not light up screen or play sound.time-sensitive: Lights up screen and may play a sound; May be presented during Do Not Disturb.timestamp in milliseconds (timezone - UTC)
E.g.
http://:/v1/sender/?sound=1&priority=10&title=hello©=123&autocopy=1Overwrite Content-Type
http://:/v1/sender/?content-type=$ curl --form "link=@" "http://:/v1/sender/"{
"link": "",
"sound": 1,
"priority": 10,
}Send image only support POST method used serverful node.
image/png OR image/jpegcat | curl -H "Content-Type: image/jpeg" --data-binary @- "http://:/v1/sender/"multipart/form-data$ curl --form "image=@" "http://:/v1/sender/"Send mp3 audio only support POST method used serverful node.
audio/mpegcat | curl -H "Content-Type: audio/mpeg" --data-binary @- "http://:/v1/sender/"multipart/form-data$ curl --form "audio=@" "http://:/v1/sender/"Send file only support POST method used serverful node.
multipart/form-data$ curl --form "file=@" "http://:/v1/sender/"Send Actions (Up to 4 actions).
multipart/form-data$ curl --form "action=ActionName1|http:///" "http://:/v1/sender/"URL for script action:
chanify://action/run-script/?=&=Chanify can be configured with a yml format file, and the default path is ~/.chanify.yml.
…Node server can be disabled user registration and become a private server.
chanify serve --registerable=false --whitelist=,--registerable=false: used to disable user registrationwhitelist: list users can be add into node serverIf your token is leaked, add leaked token into the blocklist (iOS client settings).
Note: Please protect your token from leakage. The blockist need trusted node server (1.1.9 version and above).
Download the extension from Chrome web store.
Extension features:
text/image/audio/url message to ChanifyGet the Windows Client from here.
Windows Client features:
Send To Menu.CLI.docker-compose.yml).docker-compose up -ddocker-compose.yml:
version: "3"
services:
web:
image: nginx:alpine
restart: always
volumes:
- /nginx.conf:/etc/nginx/nginx.conf
- /ssl:/ssl
ports:
- 80:80
- 443:443
chanify:
image: wizjin/chanify:dev
restart: always
volumes:
- /data:/data
- /chanify.yml:/root/.chanify.yml| Key | Description |
|---|---|
| workdir | Work directory for node server. |
/nginx.conf:
…| Key | Description |
|---|---|
| hostname or ip | Internet hostname or ip for node server. |
| ssl key | SSL key file for node server. |
/chanify.yml:
server:
endpoint: https://
host: 0.0.0.0
port: 80
name:
datapath: /data
register:
enable: false
whitelist: # whitelist
- | Key | Description |
|---|---|
| hostname or ip | Internet hostname or ip for node server. |
| node name | Name for node server. |
| user id | User ids for whitelist. |
Usage
…Example: Github webhook event
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
git checkout dev)No open issues yet, or sync has not completed.