Notifications engine.
It means
the latest information; news.
Channels
Ident or topic
Clone the repo
$ go get github.com/codegangsta/gin
gin is used to to automatically compile files while you are developing
Then run
$ DEBUG=* go get && go install && gin -p 8911 -i
Now you should be able to access the below API's on port 8911
.
MongoDB config is stored in config/conf.go
.
$ go get github.com/bulletind/khabar
$ khabar
```
POST /topic/<notification_ident>/channel/<channel_ident>
```
Request:
```js
{
org: "",
user: "",
ident: ""
}
```
```
DELETE /topic/<notification_ident>/channel/<channel_ident>
```
Request:
```js
{
org: "",
user: "",
ident: ""
}
```
```
GET /channels
```
Query params:
- `org`: organization id
- `user`: user id
Response:
```js
[
{
"_id": "",
"created_on": 1425545240236,
"updated_on": 1425545240236,
"user": "",
"org": "",
"app_name": "",
"data": {
},
"ident": ""
}
]
```
```
POST /topic
```
Request:
```js
{
org: "123",
user: "",
ident: "",
app_name: "myapp"
}
```
- `ident` is requred
- `org` is required
- `app_name` is required
```
DELETE /topic/<notification_ident>
```
Request:
```js
{
org: "",
user: "",
ident: ""
}
```
```
GET /topics
```
Query params:
- `org`: organization id
- `user`: user id
Response:
```js
[
{
"_id": "",
"created_on": 1425547531188,
"updated_on": 1425879125700,
"user": "",
"org": "",
"app_name": "",
"channels": [
"",
""
],
"ident": ""
}
]
```
```
GET /notifications
```
Query params:
- `user`: user id
- `org`: organization id
Response:
```js
[
{
org: "",
user: "",
destination_uri: "",
text: "",
topic: "",
destination_uri: "",
is_read:false,
created_on: <milliseconds_since_epoch>
},
// and so on...
]
```
This can be polled periodically
```
PUT /notification/:_id
```
```
PUT /notifications
```
- `destination_uri`: Link to relevant entity. #### (i.e action, incident)
- `text`: Notification text
- `topic`: Notification topic
-
For all of the above request you must pass atleast one of the
org
oruser
or both -
For all the listings, you get a status code of
200
-
When you create a resource you get a status code of
201
-
When you modify/delete a resource you get a status code of
204
-
Response for creation of an entity
{ "body": "[ID of entity created]", "message": "Created", "status": 201 }
-
Response for modifying/deleting an entity
{ "body": "", "message": "NoContent", "status": 204 }
- Verify if the api's listed above are correct and update them.
- Break the library into multiple pieces like types, api and only keep the business logic in this repo.
- Spin up a nice demo.
- Add the admin for managing topics etc.
- Ability to use
MONGODB_URL
from environment variable. - Ability to listen on a specified port (
--port
from command line?) or viaPORT
environment variable. - Deployment and hosting.