# alarms-as-a-service

> A web service built on top of reschedule.js, rrecur.js, and rrule.js for being notified when a one-time or repeat event is taking place.

Latest version **1.0.0** (published 2014-07-07) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install alarms-as-a-service
pnpm add alarms-as-a-service
yarn add alarms-as-a-service
bun add alarms-as-a-service
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2014-07-07 |
| First published | 2014-07-07 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | AJ ONeal |
| Maintainers | coolaj86 |
| Keywords | appointment, periodic, schedule, reschedule, rrule, recur, alarm, clock, alarmclock, calendar, rrecur, recurring, icalevent, event, job, task, webhook |

## Links

- npm: https://www.npmjs.com/package/alarms-as-a-service
- Repository: https://github.com/coolaj86/alarms-as-a-service
- Issues: https://github.com/coolaj86/alarms-as-a-service/issues
- npm.io page: https://npm.io/package/alarms-as-a-service

## Dependencies (5)

- [connect](https://npm.io/package/connect.md) ^3.0.1
- [request](https://npm.io/package/request.md) ^2.37.0
- [reschedule](https://npm.io/package/reschedule.md) ^0.10.1
- [body-parser](https://npm.io/package/body-parser.md) ^1.4.3
- [es6-promise](https://npm.io/package/es6-promise.md) ^1.0.0

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2014-07-07

## README

alarms-as-a-service
===================

A web service built on top of reschedule.js, rrecur.js, and rrule.js for being notified when a one-time or repeat event is taking place.

POST /api/alarms
----------------

### Request

```javascript
{
  "dtstart": {
    "utc": "2014-06-16T12:40:00Z"
  , "zoneless": "2014-06-16T08:40:00"
  , "locale": "GMT-0400 (EDT)"
  , "tzid": "America/New_York"
  }

, "webooks": {
    "occurrence": "http://bin.mailgun.net/a90b3f8c"
  , "stop": "http://requestb.in/1hp8ppg1"
  }

, "data": {
    "foo": "bar"
  , "desc": "Whatever you supply to the 'data' field is what your webhook gets back"
  }

, rrule: {
    freq: 'yearly'
  }
}
```

NOTE:
  * `tzid` is not currently supported. You must use `locale` and either `utc` or `zoneless`.
  * You may supply `data` if you wish. It may contain whatever you like, but must be very few bytes.

### Response

```javascript
{ "uuid": "aedda258-0392-4b36-9e0c-274db9f7e9de", "next": "2014-07-16T08:40:00-0400" }
```

POST /your/webhook/occurence
------------------

```javascript
{ "uuid": "aedda258-0392-4b36-9e0c-274db9f7e9de"
, "next": "2014-06-16T08:40:00-0400"
, "data": { ... }
}
```

NOTE: `next` may be `null`

### Response

```javascript
{}
```

Or, if you want to postpone the alarm:

```javascript
{ "snooze": 900 } // 15 minutes in seconds
```


POST /your/webhook/stop
------------------

### Request

```javascript
{ "uuid": "aedda258-0392-4b36-9e0c-274db9f7e9de"
, "data": { ... }
}
```

### Response

```javascript
{}
```

Example Usage
-------------

```javascript
var url
  , rules
  ;

url = 'http://alarms.beta.coolaj86.com/api/schedules';

rules = {
  dtstart: {
    utc: new Date(Date.now() + (15 * 1000))
  , locale: 'GMT-0600 (MDT)'
  , tzid: 'America/Denver'
  }
, rrule: null
, webooks: {
    occurrence: "http://requestb.in/16rh3i11"
  , stop: "http://requestb.in/1hp8ppg1"
  }
, data: {
    foo: "bar"
  }
}

request.post({ url: url, json: rules }, function (err, resp, data) {
  console.error(err);
  console.log(data);
});
```

DIY
===

Install
------

```bash
npm install alarms-as-a-service
```

```javascript
'use strict';

var port = 3000
  , app
  , server
  ;

app = require('alarms-as-a-service').create();

server = app.listen(port, function () {
  console.log('Listening on ', server.address());
});
```

API
---

```javascript
module.exports.create() // returns an app
module.exports.alarms.add // function (req, res) {}
module.exports.alarms.remove // function (req, res) {}
```

---
_Source: https://npm.io/package/alarms-as-a-service · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
