<commit_before>Integrates API.AI and Facebook Messenger
=========

A light integration of Api.ai and Messenger for custom Node.js apps.

## Installation 
	`npm install api-messenger`

## Usage

Instantiate api_messenger
```javascript
var apiMessenger = require('api-messenger');
```

Route Fb messages to API.AI. Directly send API.AI responses to Fb Messenger.
```javascript
/* Sending message to api.ai and processing the response */
apiai.on('response', (response) => { 
	apiMessenger.send(recipientId, response);
});
```

More customisable: functions that format API.AI response into Messenger JSON.
```javascript
apiMessenger.text(recipientId, aiMessage.speech);
apiMessenger.card(recipientId, aiMessage, developer_payload);
apiMessenger.quickReply(recipientId, aiMessage, developer_payload);
etc...
```
 
For a detailed set up, see examples folder.

## Tests
	`npm test`

## Contributing
Add unit tests for new functions. Please refactor and feel free to restyle current formatting. →→
TODO: allow users to set welcome text, initial screen, menus, etc. →→
TODO: allow for API.AI to send custom payloads, e.g. sending files/attachements, etc. →→
TODO: Enable callback functions. →→
<commit_msg>fixed README styling<commit_after>Integrates API.AI and Facebook Messenger
=========

A light integration of Api.ai and Messenger for custom Node.js apps.

## Installation 
	`npm install api-messenger`

## Usage

Instantiate api_messenger
```javascript
var apiMessenger = require('api-messenger');
```

Route Fb messages to API.AI. Directly send API.AI responses to Fb Messenger.
```javascript
/* Sending message to api.ai and processing the response */
apiai.on('response', (response) => { 
	apiMessenger.send(recipientId, response);
});
```

More customisable: functions that format API.AI response into Messenger JSON.
```javascript
apiMessenger.text(recipientId, aiMessage.speech);
apiMessenger.card(recipientId, aiMessage, developer_payload);
apiMessenger.quickReply(recipientId, aiMessage, developer_payload);
etc...
```
 
For a detailed set up, see examples folder.

## Tests
	`npm test`

## Contributing
Add unit tests for new functions. Please refactor and feel free to restyle current formatting.  
TODO: allow users to set welcome text, initial screen, menus, etc.  
TODO: allow for API.AI to send custom payloads, e.g. sending files/attachements, etc.  
TODO: Enable callback functions.  

{'fraction_non_alphanumeric': 0.1067111296373489, 'fraction_numerical': 0.0, 'mean_word_length': 5.106870229007634, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6827052', 'n_tokens_mistral': 751, 'n_tokens_neox': 689, 'n_words': 258}