https://github.com/fox-one/fox-notifier
https://github.com/fox-one/fox-notifier
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fox-one/fox-notifier
- Owner: fox-one
- Created: 2019-10-08T07:46:49.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-15T07:49:45.000Z (over 6 years ago)
- Last Synced: 2025-07-09T09:08:21.678Z (about 1 year ago)
- Language: Go
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fox-notifier
## Notify Message
```bash
POST /message
```
**Params:**
```javascript
{
"message_id": "191b3672-1014-4f54-aeed-48caf0a8d0af", // optional
"topic": "test", // required
"message": "just a test", // required
}
```
**Response:**
```javascript
{
"code": 0,
"data": {
"id": 3,
"topic": "test",
"conversation_id": "3fed03e2-9799-3cf1-9a11-c90574e99209",
"message_id": "191b3672-1014-4f54-aeed-48caf0a8d0af",
"message": "just a test",
"created_at": "2019-10-09T21:28:08.525309+08:00",
"updated_at": "2019-10-09T21:28:08.525309+08:00"
}
}
```
**Error Codes:**
```go
var (
// ErrInvalidInput err invalid input
ErrInvalidInput = errors.New(1001, "invalid input")
// ErrServerFault err server fault
ErrServerFault = errors.New(1002, "internal server error", http.StatusInternalServerError)
)
```
## SDK
below is a demo
```go
package main
import (
"context"
"log"
notifier "github.com/fox-one/fox-notifier/sdk"
)
func main() {
n := notifier.NewNotifier("http://localhost:8888")
msg, err := n.NotifyMessage(context.TODO(), "", "test", "test")
log.Println(msg, err)
}
```