English | 简体中文
Chanify是一个简单的消息推送工具。每一个人都可以利用提供的API来发送消息推送到自己的iOS设备上。
你还可以部署自己的服务器。
-
从AppStore安装iOS应用(1.0.0或以上版本)。
-
从频道详情页面来获取发送使用的令牌
token
。 -
使用API来发送消息。
-
也可以通过长按扫描二维码图标来进入创建频道,创建自定义的频道。
- GET 方式
https://api.chanify.net/v1/sender/<token>/<message>
- POST 方式
https://api.chanify.net/v1/sender/<token>
Content-Type:
text/plain
: Body is text messagemultipart/form-data
: The block of data("text") is text messageapplication/x-www-form-urlencoded
:text=<url encoded text message>
支持以下参数:
参数名 | 描述 |
---|---|
title | 通知消息的标题 |
sound | 1 启用声音提示, 其他情况会静音推送 |
priority | 10 默认优先级, 或者 5 较低优先级 |
例如:
https://api.chanify.net/v1/sender/<token>?sound=1&priority=10&title=hello
# 发送文本消息
$ curl --form-string "text=hello" "https://api.chanify.net/v1/sender/<token>"
# 发送文本文件
$ cat message.txt | curl -H "Content-Type: text/plain" --data-binary @- "https://api.chanify.net/v1/sender/<token>"
from urllib import request, parse
data = parse.urlencode({ 'text': 'hello' }).encode()
req = request.Request("https://api.chanify.net/v1/sender/<token>", data=data)
request.urlopen(req)
require 'net/http'
uri = URI('https://api.chanify.net/v1/sender/<token>')
res = Net::HTTP.post_form(uri, 'text' => 'hello')
puts res.body
const https = require('https')
const querystring = require('querystring');
const data = querystring.stringify({ text: 'hello' })
const options = {
hostname: 'api.chanify.net',
port: 443,
path: '/v1/sender/token',
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://<address>:<port>/v1/sender/<token>',
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => [ 'text' => 'hello' ],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
依赖第三方工具:
- protobuf
初始化项目依赖
$ pod install
可以使用下列命令给模拟器发送推送用于测试
$ ./send.swift text=hello
贡献使开源社区成为了一个令人赞叹的学习,启发和创造场所。 十分感谢您做出的任何贡献。
- Fork本项目
- 创建您的Feature分支 (
git checkout -b feature/AmazingFeature
) - 提交您的更改 (
git commit -m 'Add some AmazingFeature'
) - 推送到分支 (
git push origin feature/AmazingFeature
) - 开启一个Pull Request
根据MIT许可证分发,详情查看LICENSE
。