<commit_before>WaitingRoom
===========

A Python module for using the AlertCaster API

http://developer.alertcaster.com/developer/apiguide

## Usage

`simple(alerts={}, recipients=[])`, runs through everything without you having to deal directly with the other functions.

* `simple(alerts={}, recipients=[])` - Runs through `createAlert`, `triggerAlert`, `deleteAlert`, and `deleteRecipientGroup` to create a custom alert, immediately send it out to recipients, and then clean up after itself.

The other functions of the WaitingRoom module can be used separately if given the correct parameters.

* `createAlert(alerts={}, recipients=[])` - Creates and stores a given alert, but does not deliver it
* `triggerAlert(triggerURL)` - Triggers the alert, sending it out to the recipients
* `deleteAlert(alertID)` - Deletes a stored alert
* `deleteRecipientGroup(groupID)` - Deletes the alert's recipient group

### Sending an SMS alert
```console
$ python
>> import waitingroom
>> wr = waitingroom.WaitingRoom(api_key)
>> alerts={"sms": "Hello World"}
>> recipients=[{"name": {"first": "John", "last": "Doe"}, "mobile": "5551234567"}]
>> wr.simple(alerts, recipients)
```

### Sending an alert to multiple recipients
Recipients is an array of objects, just pass in the "name" object along with any additional/required objects (i.e. "mobile").
```console
>> recipients=[{"name": {"first": "John", "last": "Doe"}, "mobile": "5551234567"}, {"name": {"first": "Jane", "last": "Doe"}, "mobile": "5559876543"}]
>> wr.simple(alerts, recipients)
```

## Notes
Recipients first and last name need to be set for an alert to successfully be created and sent out<commit_msg>Adds example for an email alert<commit_after>WaitingRoom
===========

A Python module for using the AlertCaster API

http://developer.alertcaster.com/developer/apiguide

## Usage

`simple(alerts={}, recipients=[])`, runs through everything without you having to deal directly with the other functions.

* `simple(alerts={}, recipients=[])` - Runs through `createAlert`, `triggerAlert`, `deleteAlert`, and `deleteRecipientGroup` to create a custom alert, immediately send it out to recipients, and then clean up after itself.

The other functions of the WaitingRoom module can be used separately if given the correct parameters.

* `createAlert(alerts={}, recipients=[])` - Creates and stores a given alert, but does not deliver it
* `triggerAlert(triggerURL)` - Triggers the alert, sending it out to the recipients
* `deleteAlert(alertID)` - Deletes a stored alert
* `deleteRecipientGroup(groupID)` - Deletes the alert's recipient group

### Sending an SMS alert
```console
$ python
>> import waitingroom
>> wr = waitingroom.WaitingRoom(api_key)
>> alerts={"sms": "Hello World"}
>> recipients=[{"name": {"first": "John", "last": "Doe"}, "mobile": "5551234567"}]
>> wr.simple(alerts, recipients)
```

### Sending an email alert
```console
$ python
>> import waitingroom
>> wr = waitingroom.WaitingRoom(api_key)
>> alerts={"email": {"subject": "Some Subject Here", "body": "<strong>Hello World</strong><p>This is a test...</p>"}}
>> recipients=[{"name": {"first": "John", "last": "Doe"}, "email": "<EMAIL>"}]
>> wr.simple(alerts, recipients)
```

### Sending an alert to multiple recipients
Recipients is an array of objects, just pass in the "name" object along with any additional/required objects (i.e. "mobile").
```console
>> recipients=[{"name": {"first": "John", "last": "Doe"}, "mobile": "5551234567"}, {"name": {"first": "Jane", "last": "Doe"}, "mobile": "5559876543"}]
>> wr.simple(alerts, recipients)
```

## Notes
You need to initialize the module with an API key as a string (i.e. “<KEY>1" instead of `apikey` in the examples), so be sure to grab one from http://developer.alertcaster.com/developer/apikey

Recipients first and last name need to be set for an alert to successfully be created and sent out
{'fraction_non_alphanumeric': 0.15303225806451612, 'fraction_numerical': 0.015741935483870966, 'mean_word_length': 5.740869565217391, 'pattern_counts': {'":': 33, '<': 9, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2157628', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1105, 'n_words': 435}