Scheduly is a Lightweight NodeJS webhooks scheduler
- [Docker] (https://www.docker.com)
MONGO_URL
(default:mongodb://localhost/agenda
)NODE_ENV
(values:production
ordeveloppement
)IP
(default:localhost
)PORT
(default:8080
)
docker build -t scheduly .
docker run --rm -ti -p 8080:8080 -v "$PWD":/usr/src/app --net host -e "NODE_ENV=production" scheduly
Creates a webhooks with the given body.
- URL
- Scheduling Interval ([cron format] (http://www.nncron.ru/help/EN/working/cron-format.htm) or [human interval] (https://github.com/rschmukler/human-interval))
- Body
POST http://localhost:8080/webhooks
- Body :
{
"url": "http://requestb.in/1nlqxcr1",
"scheduling": "* * * * *",
"body": {
"hello":"world"
}
}
- Response:
Status: 201
[
{
"id": "5730a487a3dc0e13009c0a45",
"url": "http://requestb.in/1nlqxcr1",
"body": {
"hello": "world"
},
"lastRunAt": null,
"lastFinishedAt": null,
"nextRunAt": "2016-05-09T14:56:00.246Z"
}
]
- If
scheduling interval
is at the cron format, the webhooks will be executed everyscheduling interval
. - If
scheduling inverval
is at the human interval format, the webhooks will be executed once atscheduling interval
.
POST http://localhost:8080/webhooks
- Body :
{
"url": "http://requestb.in/1nlqxcr1",
"body": {
"hello":"world"
}
}
- Response:
Status: 400
{
'error': {
message: 'Missing required parameter'
}
}
POST http://localhost:8080/webhooks
- Body :
{
"scheduling": "* * * * *",
"body": {
"hello":"world"
}
}
- Response:
Status: 400
{
'error': {
message: 'Missing required parameter'
}
}
POST http://localhost:8080/webhooks
- Body :
{
"url": "http://requestb.in/1nlqxcr1",
"scheduling": "test",
"body": {
"hello":"world"
}
}
- Response:
Status: 400
{
'error': {
message: 'test is not a valid time interval !'
}
}
Updates a given webhooks with the new body.
- URL
- Scheduling Interval ([cron format] (http://www.nncron.ru/help/EN/working/cron-format.htm) or [human interval] (https://github.com/rschmukler/human-interval))
- Body
PUT http://localhost:8080/webhooks/5730a487a3dc0e13009c0a45
- Body :
{
"url": "http://requestb.in/1nlqxcr1",
"scheduling": "in 2 minutes",
"body": {
"hello":"world"
}
}
- Response:
Status: 200
[
{
"id": "5730a487a3dc0e13009c0a45",
"url": "http://requestb.in/1nlqxcr1",
"body": {
"hello": "world"
},
"lastRunAt": null,
"lastFinishedAt": null,
"nextRunAt": "2016-05-09T14:56:00.246Z"
}
]
- If
scheduling interval
is at the cron format, the webhooks will be executed everyscheduling interval
. - If
scheduling inverval
is at the human interval format, the webhooks will be executed once atscheduling interval
.
PUT http://localhost:8080/webhooks/5730a487a3dc0e13009c0a45
- Body :
{
"url": "http://requestb.in/1nlqxcr1",
"scheduling": "in 2 minutes",
"body": {
"hello":"world"
}
}
- Response:
Status: 404
{
'error': {
message: 'No webhooks to update'
}
}
PUT http://localhost:8080/webhooks/azerty
- Body :
{
"url": "http://requestb.in/1nlqxcr1",
"scheduling": "in 2 minutes",
"body": {
"hello":"world"
}
}
- Response:
Status: 404
{
'error': {
message: 'Invalid webhooks id'
}
}
Returns webhooks
GET http://localhost:8080/webhooks
- Response:
Status: 200
[
{
"id": "5730a487a3dc0e13009c0a45",
"url": "http://requestb.in/1nlqxcr1",
"body": {
"hello": "world"
},
"lastRunAt": null,
"lastFinishedAt": null,
"nextRunAt": "2016-05-09T14:56:00.246Z",
"status": "scheduled"
}
]
GET http://localhost:8080/webhooks/5730a487a3dc0e13009c0a45
- Response:
Status: 200
[
{
"id": "5730a487a3dc0e13009c0a45",
"url": "http://requestb.in/1nlqxcr1",
"body": {
"hello": "world"
},
"lastRunAt": null,
"lastFinishedAt": null,
"nextRunAt": "2016-05-09T14:56:00.246Z",
"status": "scheduled"
}
]
GET http://localhost:8080/webhooks?previous_cursor=5730a487a3dc0e13009c0a45&next_cursor=5730a487a3dc0e13009c0a45
- Response:
Status: 200
[
{
"id": "5730a487a3dc0e13009c0a45",
"url": "http://requestb.in/1nlqxcr1",
"body": {
"hello": "world"
},
"lastRunAt": null,
"lastFinishedAt": null,
"nextRunAt": "2016-05-09T14:56:00.246Z",
"status": "scheduled"
},
{
"id": "5730a487a3dc0e13009c0a46",
"url": "http://requestb.in/1nlqxcr1",
"body": {
"hello": "world"
},
"lastRunAt": null,
"lastFinishedAt": null,
"nextRunAt": "2016-05-09T14:56:00.246Z",
"status": "scheduled"
}
]
GET http://localhost:8080/webhooks?limit=2
- Response:
Status: 200
[
{
"id": "5730a487a3dc0e13009c0a45",
"url": "http://requestb.in/1nlqxcr1",
"body": {
"hello": "world"
},
"lastRunAt": null,
"lastFinishedAt": null,
"nextRunAt": "2016-05-09T14:56:00.246Z",
"status": "scheduled"
},
{
"id": "5730a487a3dc0e13009c0a46",
"url": "http://requestb.in/1nlqxcr1",
"body": {
"hello": "world"
},
"lastRunAt": null,
"lastFinishedAt": null,
"nextRunAt": "2016-05-09T14:56:00.246Z",
"status": "scheduled"
}
]
GET http://localhost:8080/webhooks/azerty
- Response:
Status: 404
{
'error': {
message: 'Invalid webhooks id'
}
}
Removes the given webhooks if a query parameter (id
) is given or removes all webhooks
DELETE http://localhost:8080/webhooks
- Response:
Status: 200
[
{
"id": "5730a487a3dc0e13009c0a45",
"url": "http://requestb.in/1nlqxcr1",
"body": {
"hello": "world"
},
"lastRunAt": null,
"lastFinishedAt": null,
"nextRunAt": "2016-05-09T14:56:00.246Z"
},
{
"id": "5730a487a3dc0e13009c0a46",
"url": "http://requestb.in/1nlqxcr1",
"body": {
"hello": "world"
},
"lastRunAt": null,
"lastFinishedAt": null,
"nextRunAt": "2016-05-09T14:56:00.246Z",
"status": "scheduled"
}
]
DELETE http://localhost:8080/webhooks/5730a487a3dc0e13009c0a45
[
{
"id": "5730a487a3dc0e13009c0a45",
"url": "http://requestb.in/1nlqxcr1",
"body": {
"hello": "world"
},
"lastRunAt": null,
"lastFinishedAt": null,
"nextRunAt": "2016-05-09T14:56:00.246Z"
}
]
DELETE http://localhost:8080/webhooks/5730a487a3dc0e13009c0a45
- Response:
Status: 404
{
'error': {
message: 'No webhooks to remove'
}
}
DELETE http://localhost:8080/webhooks
- Response:
Status: 404
{
'error': {
message: 'No webhooks to remove'
}
}
DELETE http://localhost:8080/azerty
- Response:
Status: 404
{
'error': {
message: 'Invalid webhooks id'
}
}
- [NodeJS] (https://nodejs.org)
- [MongoDB] (https://www.mongodb.com/)
or - [Docker] (https://www.docker.com)
MONGO_URL
(default:mongodb://localhost/agenda
)NODE_ENV
(values:production
ordeveloppement
)IP
(default:localhost
)PORT
(default:8080
)
npm run build
mongod
(on an other terminal)npm start
docker build -t scheduly .
docker run --rm -ti -p 8080:8080 -v "$PWD":/usr/src/app node:onbuild npm install
docker run --rm -ti -p 8080:8080 -v "$PWD":/usr/src/app --net host scheduly