<commit_before># Agentia-Semaphore
Agentia-Semaphore is a Node.js module, which provides an object oriented wrapper for the [Semaphore.co](http://www.semaphore.co/) SMS gateway API. With Semaphore you can send SMS messages to all major mobile networks in the Philippines, including Smart, Globe, and Sun, using the 

## Usage

### Installation

[![NPM version](https://badge.fury.io/js/agentia-semaphore.png)](https://www.npmjs.com/package/agentia-semaphore)
[![Build Status](https://travis-ci.org/AgentiaSystems/agentia-semaphore.svg?branch=master)](https://travis-ci.org/AgentiaSystems/agentia-semaphore)
[![Coverage Status](https://coveralls.io/repos/AgentiaSystems/agentia-semaphore/badge.svg?branch=master)](https://coveralls.io/r/AgentiaSystems/agentia-semaphore)
[![Code Climate](https://codeclimate.com/github/AgentiaSystems/agentia-semaphore/badges/gpa.svg)](https://codeclimate.com/github/AgentiaSystems/agentia-semaphore)

Install with the Node.js package manager [npm](http://npmjs.org/):

    $ npm install --save agentia-semaphore

### Configuration Options

The Agentia-Semaphore API provides the following configuration options.

`api key` (*Required*) - Configures your Semaphore API Key. Use of Agentia-Semaphore requires a [Semaphore](http://www.semaphore.co/) API key. Using the Agentia-Semaphore without setting `api key` will result in an exception.

`from` (*Optional*, *Default*: 'SEMAPHORE') - Sets the default name/number the message should originate from. You can also set the `from` option for each individual message. 

> *NOTE: According to the [Semaphore.co](http://www.semaphore.co/documentation#sending) documentation, "This feature is not available to everyone." Please consult with [Semaphore](http://www.semaphore.co/) to enable this feature.*


##### Setting the configuration options
Using `semaphore.set(option, value)`, where `option` is a string corresponding to the option being set, and `value` is the desired setting for the option.


    var semaphore = require('agentia-semaphore');    
    semaphore.set('api key', 'your_semaphore_api_key');

##### Setting the API key using the Environment Variable
You can also configure your Semaphore API using the `SEMAPHORE_API_KEY` environment variable. Environment variables can be set directly on your operating system or using [dovenv](https://github.com/bkeepers/dotenv).

    SEMAPHORE_API_KEY=your_semaphore_api_key

> *NOTE: Some Node.js hosting providers require that environment variables are set via either their website or they CLI configuration tool. Consult your hosting provider's documentation for more information.*
>
> Heroku: [Configuration and Config Variables](https://devcenter.heroku.com/articles/config-vars#setting-up-config-vars-for-a-deployed-application)
> 
> AppFog: [Application Environment](https://docs.appfog.com/getting-started/af-cli#app-env)
>
> OpenShift: [How Create and Use Environment Variables](https://www.openshift.com/kb/kb-e1072-how-to-create-and-use-environment-variables-on-the-server)

### The Agentia-Semaphore API
Our API mirrors all the functions available in the [Semaphore.co](http://www.semaphore.co/documentation) API.

#### Sending Messages

To send messages you use the `semaphore.sms()` api function.

	semaphore.sms(<number>, <message>, [<from>], [<callback>]);
    
The function accepts four parameters:

`number` *(required)* - a string with the destination mobile number.  You can use any of the following formats:

- 10-digit number (e.g. 9995551212)
- 11-digit number, with leading zero (e.g. 09995551212)
- 12-digit number, with Philippine country code (e.g. 639995551212)
- 12-digit number, with a leading plus sign (e.g. +639995551212)

Dashes, spaces and dots are automatically stripped from the number, you can also use something like 0999-555-1212.

`message` *(required)*  - a string with the text message you wish to send. Because of the 160 character SMS limitation, messages longer than 160 charactes will deduct more than 1 credit from your [Semaphore](http://www.semaphore.co/) account.<commit_msg>added logo to readme other minor readme  updates<commit_after>
![agentia-semaphore logo](media/logo.png)
---
[![Build Status](https://travis-ci.org/AgentiaSystems/agentia-semaphore.svg?branch=master)](https://travis-ci.org/AgentiaSystems/agentia-semaphore)
[![Coverage Status](https://coveralls.io/repos/AgentiaSystems/agentia-semaphore/badge.svg?branch=master)](https://coveralls.io/r/AgentiaSystems/agentia-semaphore)
[![Code Climate](https://codeclimate.com/github/AgentiaSystems/agentia-semaphore/badges/gpa.svg)](https://codeclimate.com/github/AgentiaSystems/agentia-semaphore)

**agentia-semaphore** is a Node.js module, which provides an object oriented wrapper for the [Semaphore.co](http://www.semaphore.co/) SMS gateway API. With Semaphore you can send SMS messages to all major mobile networks in the Philippines, including Smart, Globe, and Sun, using the 

## Usage

### Installation

[![NPM version](https://badge.fury.io/js/agentia-semaphore.png)](https://www.npmjs.com/package/agentia-semaphore)

Install with the Node.js package manager [npm](http://npmjs.org/):

    $ npm install --save agentia-semaphore

### Configuration Options
**agentia-semaphore**
The **agentia-semaphore** API provides the following configuration options.

`api key` (*Required*) - Configures your Semaphore API Key. Use of **agentia-semaphore** requires a [Semaphore](http://www.semaphore.co/) API key. Using the **agentia-semaphore** without setting `api key` will result in an exception.

`from` (*Optional*, *Default*: 'SEMAPHORE') - Sets the default name/number the message should originate from. You can also set the `from` option for each individual message. 

> *NOTE: According to the [Semaphore.co](http://www.semaphore.co/documentation#sending) documentation, "This feature is not available to everyone." Please consult with [Semaphore](http://www.semaphore.co/) to enable this feature.*


##### Setting the configuration options
Using `semaphore.set(option, value)`, where `option` is a string corresponding to the option being set, and `value` is the desired setting for the option.


    var semaphore = require('agentia-semaphore');    
    semaphore.set('api key', 'your_semaphore_api_key');

##### Setting the API key using the Environment Variable
You can also configure your Semaphore API using the `SEMAPHORE_API_KEY` environment variable. Environment variables can be set directly on your operating system or using [dovenv](https://github.com/bkeepers/dotenv).

    SEMAPHORE_API_KEY=your_semaphore_api_key

> *NOTE: Some Node.js hosting providers require that environment variables are set via either their website or they CLI configuration tool. Consult your hosting provider's documentation for more information.*
>
> Heroku: [Configuration and Config Variables](https://devcenter.heroku.com/articles/config-vars#setting-up-config-vars-for-a-deployed-application)
> 
> AppFog: [Application Environment](https://docs.appfog.com/getting-started/af-cli#app-env)
>
> OpenShift: [How Create and Use Environment Variables](https://www.openshift.com/kb/kb-e1072-how-to-create-and-use-environment-variables-on-the-server)

### The agentia-semaphore API
Our API mirrors all the functions available in the [Semaphore.co](http://www.semaphore.co/documentation) API.

#### Sending Messages

To send messages you use the `semaphore.sms()` api function.

	semaphore.sms(<number>, <message>, [<from>], [<callback>]);
    
The function accepts four parameters:

`number` *(required)* - a string with the destination mobile number.  You can use any of the following formats:

- 10-digit number (e.g. 9995551212)
- 11-digit number, with leading zero (e.g. 09995551212)
- 12-digit number, with Philippine country code (e.g. 639995551212)
- 12-digit number, with a leading plus sign (e.g. +639995551212)

Dashes, spaces and dots are automatically stripped from the number, you can also use something like 0999-555-1212.

`message` *(required)*  - a string with the text message you wish to send. Because of the 160 character SMS limitation, messages longer than 160 charactes will deduct more than 1 credit from your [Semaphore](http://www.semaphore.co/) account.
{'fraction_non_alphanumeric': 0.11776155717761558, 'fraction_numerical': 0.01824817518248175, 'mean_word_length': 5.053755522827688, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 27, 'https://': 24, 'lorem ipsum': 0, 'www.': 16, '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': '4242684', 'n_tokens_mistral': 2673, 'n_tokens_neox': 2465, 'n_words': 778}