<commit_before>zamano-api
==========

Node.js API for Zamano<commit_msg>Updated README.md with basic method documentation<commit_after>zamano-api
==========

Node.js API for Zamano, a mobile message aggregation service.  Allows servers to send and recieve mobile text and binary messages.

Setup
-----

To install the package, run:

  `npm install zaman-api`
  
Then call `require` with your ID and password provided by Zamano to identify your server.

  ```JavaScript
  var zamano = require('zamano-api')('ZAMANO_ID', 'ZAMANO_PASSWORD')
  ```

Usage
-----

Zamano has API methods for both sending and receiving mobile messages.

### zamano.sendMessage(opts, callback)

Sends a message to a mobile number, returning either a success object or error object with messages from Zamano's service.  Internally, this method sends a request to Zamano's HTTP API and parses the XML response into a JavaScript object.

Params:
  - `opts` (Object) 
    * `
  - `callback` function - 

### zamano.handleMessages(opts)

Express middleware for parsing SMS message requests from Zamano.  Use the function as middleware in a app.get('<URL>') function to authenticate the request from Zamano and add a `mobileMessage` property to the `request` object:

  ```Javascript
  app.get('/api/mo', zamano.mobileMessage(), function(req, res) {
    console.dir(req.mobileMessage)
  })
  ```

The mobileMessage object has the following properties:
  
{'fraction_non_alphanumeric': 0.10119465917076599, 'fraction_numerical': 0.0, 'mean_word_length': 4.274074074074074, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '3032416', 'n_tokens_mistral': 421, 'n_tokens_neox': 401, 'n_words': 164}