# SkyNotice API Documentation > SkyNotice 是企業多平台推播通知系統,支援 LINE、Facebook Messenger、Telegram、Email、APP Push、Web Push 六大平台。 ## API Endpoint POST https://skynotice.tw/api/notify Content-Type: application/json ## Required Parameters | Parameter | Type | Description | |-----------|------|-------------| | company_token | string | Company Token (from dashboard) | | type_token | string | Notification type Token (from dashboard) | | timestamp | integer | Unix timestamp for replay protection (valid within ±5 minutes) | | title | string | Notification title | | content | string | Notification content | ## Optional Parameters | Parameter | Type | Description | |-----------|------|-------------| | weblink | string | URL to open when notification is clicked | | other | string | Additional information | | target_member_sn | integer | Specific member ID (0 or omit = all subscribers) | ## Success Response ```json { "status": "success", "code": "OK", "message": "通知已成功建立", "data": { "notice_code": "aBcDeFgH12345678" } } ``` ## Error Response ```json { "status": "error", "code": "ERROR_CODE", "message": "Error description" } ``` ## Error Codes | Code | Description | |------|-------------| | METHOD_NOT_ALLOWED | Only POST method accepted | | INVALID_CONTENT_TYPE | Content-Type must be application/json | | EMPTY_BODY | Request body is empty | | INVALID_JSON | Invalid JSON format | | MISSING_TIMESTAMP | Missing timestamp parameter | | INVALID_TIMESTAMP | Invalid timestamp format | | TIMESTAMP_EXPIRED | Request expired (timestamp beyond ±5 minutes) | | RATE_LIMIT_EXCEEDED | Too many requests (100 per token per minute) | | MISSING_REQUIRED_FIELDS | Missing required fields | | INVALID_TOKEN | Token verification failed | | EMPTY_TITLE | Title cannot be empty | | EMPTY_CONTENT | Content cannot be empty | ## Quick Start Examples ### cURL ```bash curl -X POST https://skynotice.tw/api/notify \ -H "Content-Type: application/json" \ -d '{ "company_token": "YOUR_COMPANY_TOKEN", "type_token": "YOUR_TYPE_TOKEN", "timestamp": '$(date +%s)', "title": "Test Notification", "content": "Hello from SkyNotice API" }' ``` ### PHP ```php $data = [ "company_token" => "YOUR_COMPANY_TOKEN", "type_token" => "YOUR_TYPE_TOKEN", "timestamp" => time(), "title" => "Test Notification", "content" => "Hello from SkyNotice API" ]; $ch = curl_init("https://skynotice.tw/api/notify"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = json_decode(curl_exec($ch), true); curl_close($ch); ``` ### JavaScript ```javascript const res = await fetch("https://skynotice.tw/api/notify", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ company_token: "YOUR_COMPANY_TOKEN", type_token: "YOUR_TYPE_TOKEN", timestamp: Math.floor(Date.now() / 1000), title: "Test Notification", content: "Hello from SkyNotice API" }) }); const result = await res.json(); ``` ### Python ```python import requests, time result = requests.post("https://skynotice.tw/api/notify", json={ "company_token": "YOUR_COMPANY_TOKEN", "type_token": "YOUR_TYPE_TOKEN", "timestamp": int(time.time()), "title": "Test Notification", "content": "Hello from SkyNotice API" }).json() ``` ## Rate Limits - 100 requests per company_token per minute - Timestamp must be within ±5 minutes of server time ## Notes - Notifications are delivered asynchronously via background cronjobs - Supported platforms: Facebook Messenger, LINE, Telegram, Email, APP Push, Web Push - Each platform delivery status is tracked independently - Members must subscribe and bind their devices to receive notifications ## Optional - [llms-full.txt](https://skynotice.tw/llms-full.txt): Full documentation with platform details, Web Push API, APP API, security mechanisms and code examples